-
Notifications
You must be signed in to change notification settings - Fork 0
32 lines (27 loc) · 1.17 KB
/
pages.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
name: GitHub Actions Build and Deploy Demo
on: # 指定触发workflow的条件,这里是指定了每push一次到main分支,则触发一次
push:
branches:
- main
jobs: # workflows文件主体,可以指定一个或者多个,这里指定了一个job - build-and-deploy
build-and-deploy:
runs-on: ubuntu-latest # 在最新的ubuntu上运行
steps: # 指定每个job的运行步骤
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '16.14.0'
- name: Checkout # 步骤名称
uses: actions/checkout@v2 # If you're using actions/checkout@v2 you must set persist-credentials to false in most cases for the deployment to work correctly.
with:
persist-credentials: false
- name: Install and Build
run: | # 该步骤要运行的命令,这里就是部署react 的命令
npm install
npm run build
- name: Deploy
uses: JamesIves/github-pages-deploy-action@releases/v3 # 执行一些公开的action
with:
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }} # 这里是我们刚刚创建密钥的变量名称
BRANCH: gh-pages
FOLDER: build