-
Notifications
You must be signed in to change notification settings - Fork 0
57 lines (56 loc) · 1.59 KB
/
deploy-github-pages.yml
File metadata and controls
57 lines (56 loc) · 1.59 KB
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
name: React Starter For GitHub Pages
on:
push:
branches:
- main
- dev
jobs:
Build:
# 👉🏻 install + build
runs-on: ubuntu-22.04
steps:
- name: checkout code
uses: actions/checkout@v2
- name: setup node
uses: actions/setup-node@v2
with:
node-version: '16.16'
# cache: 'yarn'
# cache-dependency-path: '**/yarn.lock'
# 缓存 有需要可以开启 同时 setu node 也可以进行缓存
# - name: yarn cache
# id: yarn-cahce-dir-path
# run: echo "::set-output name=dir::$(yarn cache dir)"
# - uses: actions/cache@v2
# id: yarn-cache
# with:
# path: ${{ steps.yarn-cahce-dir-path.outputs.dir }}
# key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
# restore-keys: |
# ${{ runner.os }}-yarn-
- run: npm install && npm run build
# 上传打包好的文件,所以下一步可以使用
- name: upload files
uses: actions/upload-artifact@v2
with:
name: build-pages
path: build
retention-days: 1
Deploy:
# 👉🏻 deploy to github pages
needs: Build # 确保build 阶段完成
runs-on: ubuntu-22.04
steps:
- name: checkout code
uses: actions/checkout@v2
- name: download build files
uses: actions/download-artifact@v2
with:
name: build-pages
path: build
- name: deploy
uses: JamesIves/github-pages-deploy-action@v4.2.3
with:
branch: gh-pages
folder: build
token: "${{ secrets.GITHUBTOKENALL }}"