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 : Deploy site files
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 : Deploy to Server # 第二步,rsync推文件
21+ uses : AEnterprise/rsync-deploy@v1.0 # 使用别人包装好的步骤镜像
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 : Restart server # 第三步,重启服务
31+ uses : appleboy/ssh-action@master
32+ with :
33+ host : ${{ secrets.SSH_HOST }} # 下面三个配置与上一步类似
34+ username : ${{ secrets.SSH_USERNAME }}
35+ key : ${{ secrets.DEPLOY_KEY }}
36+ # 重启的脚本,根据自身情况做相应改动,一般要做的是migrate数据库以及重启服务器
37+ script : |
38+ cd $WORK_HOME
39+ ./rebuild.sh
40+ env :
41+ WORK_HOME : ${{ secrets.WORK_HOME }}
You can’t perform that action at this time.
0 commit comments