-
Notifications
You must be signed in to change notification settings - Fork 221
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
42 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
name: Rebuild Sphinx Server | ||
|
||
on: | ||
push: | ||
branches: | ||
- master # 只在master上push触发部署 | ||
paths-ignore: # 下列文件的变更不触发部署,可以自行添加 | ||
- README.md | ||
- LICENSE | ||
- md2rst.py | ||
- source/conf.py | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest # 使用ubuntu系统镜像运行自动化脚本 | ||
|
||
steps: # 自动化步骤 | ||
- uses: actions/checkout@v2 # 第一步,下载代码仓库 | ||
|
||
- name: Sync Files to Server # 第二步,rsync推文件 | ||
uses: AEnterprise/rsync-deploy@v1.0 # 使用别人包装好的步骤镜像 | ||
env: | ||
DEPLOY_KEY: ${{ secrets.DEPLOY_KEY }} # 引用配置,SSH私钥 | ||
ARGS: -avz --delete --exclude='*.pyc' # rsync参数,排除.pyc文件 | ||
SERVER_PORT: ${{ secrets.SSH_PORT }} # SSH端口 | ||
FOLDER: ./ # 要推送的文件夹,路径相对于代码仓库的根目录 | ||
SERVER_IP: ${{ secrets.SSH_HOST }} # 引用配置,服务器的host名(IP或者域名domain.com) | ||
USERNAME: ${{ secrets.SSH_USERNAME }} # 引用配置,服务器登录名 | ||
SERVER_DESTINATION: ${{ secrets.WORK_HOME }} # 部署到目标文件夹 | ||
- name: Rebuild and Restart Server # 第三步,重新部署服务 | ||
uses: appleboy/ssh-action@master | ||
env: | ||
WORK_HOME: ${{ secrets.WORK_HOME }} | ||
with: | ||
host: ${{ secrets.SSH_HOST }} # 下面三个配置与上一步类似 | ||
username: ${{ secrets.SSH_USERNAME }} | ||
port: ${{ secrets.SSH_PORT }} # SSH端口 | ||
key: ${{ secrets.DEPLOY_KEY }} # 私钥 | ||
script: | | ||
cd $WORK_HOME | ||
./rebuild.sh | ||
envs: WORK_HOME # 要传入 script 的环境变量 |