Skip to content

Commit d8b9d06

Browse files
author
singi.qin
committed
1
1 parent 79a2add commit d8b9d06

File tree

2 files changed

+25
-16239
lines changed

2 files changed

+25
-16239
lines changed

.github/workflows/deploy.yml

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,12 @@ on:
44
push:
55
branches:
66
- main
7-
# Review gh actions docs if you want to further define triggers, paths, etc
8-
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#on
7+
# 可根据需要添加 paths 过滤(仅当特定目录修改时触发)
8+
# paths:
9+
# - 'docs/**'
10+
# - 'src/**'
11+
# - 'package.json'
12+
# - 'pnpm-lock.yaml'
913

1014
jobs:
1115
build:
@@ -14,36 +18,42 @@ jobs:
1418
steps:
1519
- uses: actions/checkout@v4
1620
with:
17-
fetch-depth: 0
18-
- uses: actions/setup-node@v4
21+
fetch-depth: 0 # Docusaurus 需要完整提交历史(如版本记录)
22+
23+
- name: Setup Node.js
24+
uses: actions/setup-node@v4
1925
with:
2026
node-version: 20
21-
cache: npm
27+
cache: 'pnpm' # 缓存 pnpm 依赖(替代原来的 npm 缓存)
28+
29+
- name: Install pnpm
30+
# 利用 Node.js 自带的 corepack 启用 pnpm(无需额外下载)
31+
run: |
32+
corepack enable
33+
corepack prepare pnpm@latest --activate # 锁定 pnpm 最新稳定版(可指定版本如 pnpm@9.0.0)
34+
35+
- name: Install dependencies (pnpm CI mode)
36+
# 等价于 npm ci,严格遵循 pnpm-lock.yaml,不更新锁文件
37+
run: pnpm install --frozen-lockfile
2238

23-
- name: Install dependencies
24-
run: npm ci
2539
- name: Build website
40+
# 保持脚本不变(package.json 中的 build 脚本通用),也可改为 pnpm run build
2641
run: npm run build
2742

2843
- name: Upload Build Artifact
2944
uses: actions/upload-pages-artifact@v3
3045
with:
31-
path: build
46+
path: build # Docusaurus 构建输出目录(默认是 build,若改了配置需对应调整)
3247

3348
deploy:
3449
name: Deploy to GitHub Pages
3550
needs: build
36-
37-
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
3851
permissions:
39-
pages: write # to deploy to Pages
40-
id-token: write # to verify the deployment originates from an appropriate source
41-
42-
# Deploy to the github-pages environment
52+
pages: write
53+
id-token: write
4354
environment:
4455
name: github-pages
4556
url: ${{ steps.deployment.outputs.page_url }}
46-
4757
runs-on: ubuntu-latest
4858
steps:
4959
- name: Deploy to GitHub Pages

0 commit comments

Comments
 (0)