-
Notifications
You must be signed in to change notification settings - Fork 1
38 lines (35 loc) · 1.23 KB
/
deploy.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# 一个workflow,名为deploy
name: deploy
on: # 此CI/CD触发时的事件
push: # 在代码提交时自动触发
branches:
- main
# 一个 CI/CD 的工作流有许多 jobs 组成,比如最典型的 job 是 lint,test,build。
jobs:
build: # 构建job
runs-on: ubuntu-latest # 跑workflow的服务器系统
steps: # job的一系列动作
# 切换分支获取源码
- name: Checkout # step的名称,将会在 github action 的控制台中显示
# 选择一个action,可以理解为若干 steps.run,有利于代码复用
uses: actions/checkout@main
# 安装使用 node:10
- name: use Node.js 10
uses: actions/setup-node@v1
with:
node-version: 10
# 运行命令,npm install && npm run build
- name: npm install and build
run: |
npm install
npm run build
env:
CI: true
- name: Rsync Deployments Action
uses: Burnett01/[email protected]
with:
switches: -avzr --delete
remote_path: /www/server/nginx/html/life
remote_host: ${{ secrets.DEPLOY_HOST }}
remote_user: ${{ secrets.DEPLOY_USER }}
remote_key: ${{ secrets.DEPLOY_KEY }}