Skip to content

Commit b19288b

Browse files
committed
refactor: 添加构建缓存
1 parent 16e477c commit b19288b

1 file changed

Lines changed: 11 additions & 12 deletions

File tree

.github/workflows/gh-pages.yml

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,23 +12,22 @@ permissions:
1212
jobs:
1313
build:
1414
runs-on: ubuntu-latest
15-
strategy:
16-
matrix:
17-
node-version: [22.x]
1815
steps:
19-
- uses: actions/checkout@v4
20-
- name: Setup Nodejs ${{ matrix.node-version }}
16+
- name: Checkout Git
17+
uses: actions/checkout@v4
18+
- name: Setup Nodejs
2119
uses: actions/setup-node@v4
2220
with:
23-
node-version: ${{ matrix.node-version }}
24-
- name: Build
25-
run: |
26-
npm install
27-
npm run build
28-
- name: Upload static site to Pages
21+
node-version: latest
22+
cache: npm # 因为cache依赖package.json 所以需要先checkout
23+
- name: Npm Install
24+
run: npm install
25+
- name: Npm Build
26+
run: npm run build
27+
- name: Upload Pages
2928
uses: actions/upload-pages-artifact@v3
3029
with:
31-
path: ./dist # 就是之前 peaceiris 的 publish_dir
30+
path: ./dist # 部署编译后的文件
3231
deploy:
3332
needs: build
3433
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)