File tree Expand file tree Collapse file tree 1 file changed +45
-19
lines changed
Expand file tree Collapse file tree 1 file changed +45
-19
lines changed Original file line number Diff line number Diff line change 11name : Deploy GitHub Pages
22
3- # 触发条件:在 push 到 master 分支后
4- on :
3+ on :
54 push :
65 branches :
76 - master
7+ - dev
88
9- # 任务
109jobs :
11- build-and-deploy :
12- # 服务器环境:最新版 Ubuntu
10+ Build :
1311 runs-on : ubuntu-latest
1412 steps :
15- # 拉取代码
16- - name : Checkout
13+ # 步骤名称
14+ - name : checkout code
15+ uses : actions/checkout@v2
16+ - name : actions/setup-node@v2
17+ uses : actions/setup-node@v2
18+ with :
19+ node-version : ' 16.14'
20+ cache : ' yarn'
21+ cache-dependency-path : ' **/yarn.lock'
22+ # 缓存 有需要可以开启 同时 setu node 也可以进行缓存
23+ # - name: yarn cache
24+ # id: yarn-cahce-dir-path
25+ # run: echo "::set-output name=dir::$(yarn cache dir)"
26+ # - uses: actions/cache@v2
27+ # id: yarn-cache
28+ # with:
29+ # path: ${{ steps.yarn-cahce-dir-path.outputs.dir }}
30+ # key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
31+ # restore-keys: |
32+ # ${{ runner.os }}-yarn-
33+ - run : yarn install && yarn build
34+ # 上传打包好的文件,所以下一步可以使用
35+ - name : upload files
36+ uses : actions/upload-artifact@v2
37+ with :
38+ name : build-pages
39+ path : build
40+ retention-days : 1
41+ Deploy :
42+ needs : Build # 确保build 阶段完成
43+ runs-on : ubuntu-latest
44+ steps :
45+ - name : checkout code
1746 uses : actions/checkout@v2
47+ - name : download build files
48+ uses : actions/download-artifact@v2
1849 with :
19- persist-credentials : false
20-
21- # 生成静态文件
22- - name : Build
23- run : npm install -g yarn && yarn && yarn build:docs
24-
25- # 部署到 GitHub Pages
26- - name : Deploy
27- uses : JamesIves/github-pages-deploy-action@releases/v2
50+ name : build-pages
51+ path : build
52+ - name : deploy
53+ uses : JamesIves/github-pages-deploy-action@v4.2.3
2854 with :
29- ACCESS_TOKEN : ${{ secrets.PAGE_TOKEN }}
30- BRANCH : gh-pages
31- FOLDER : doc-site
55+ branch : gh-pages
56+ folder : doc-site
57+ token : " ${{ secrets.PAGE_TOKEN }} "
You can’t perform that action at this time.
0 commit comments