File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : Rebuild Sphinx Server
2+
3+ on :
4+ push :
5+ branches :
6+ - master # 只在master上push触发部署
7+ paths-ignore : # 下列文件的变更不触发部署,可以自行添加
8+ - README.md
9+ - LICENSE
10+ - md2rst.py
11+ - source/conf.py
12+
13+ jobs :
14+ deploy :
15+ runs-on : ubuntu-latest # 使用ubuntu系统镜像运行自动化脚本
16+
17+ steps : # 自动化步骤
18+ - uses : actions/checkout@v2 # 第一步,下载代码仓库
19+
20+ - name : Sync Files to Server # 第二步,rsync推文件
21+ uses :
AEnterprise/[email protected] # 使用别人包装好的步骤镜像 22+ env :
23+ DEPLOY_KEY : ${{ secrets.DEPLOY_KEY }} # 引用配置,SSH私钥
24+ ARGS : -avz --delete --exclude='*.pyc' # rsync参数,排除.pyc文件
25+ SERVER_PORT : ${{ secrets.SSH_PORT }} # SSH端口
26+ FOLDER : ./ # 要推送的文件夹,路径相对于代码仓库的根目录
27+ SERVER_IP : ${{ secrets.SSH_HOST }} # 引用配置,服务器的host名(IP或者域名domain.com)
28+ USERNAME : ${{ secrets.SSH_USERNAME }} # 引用配置,服务器登录名
29+ SERVER_DESTINATION : ${{ secrets.WORK_HOME }} # 部署到目标文件夹
30+ - name : Rebuild and Restart Server # 第三步,重新部署服务
31+ uses : appleboy/ssh-action@master
32+ env :
33+ WORK_HOME : ${{ secrets.WORK_HOME }}
34+ with :
35+ host : ${{ secrets.SSH_HOST }} # 下面三个配置与上一步类似
36+ username : ${{ secrets.SSH_USERNAME }}
37+ port : ${{ secrets.SSH_PORT }} # SSH端口
38+ key : ${{ secrets.DEPLOY_KEY }} # 私钥
39+ script : |
40+ cd $WORK_HOME
41+ ./rebuild.sh
42+ envs : WORK_HOME # 要传入 script 的环境变量
You can’t perform that action at this time.
0 commit comments