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
79
810jobs :
911 build :
@@ -12,26 +14,16 @@ jobs:
1214 steps :
1315 - uses : actions/checkout@v4
1416 with :
15- fetch-depth : 0 # Docusaurus 需要完整提交历史
16-
17- - name : Setup Node.js
18- uses : actions/setup-node@v4
17+ fetch-depth : 0
18+ - uses : actions/setup-node@v4
1919 with :
2020 node-version : 20
21- cache : ' pnpm' # 保持 pnpm 缓存配置
22-
23- # 关键修改:用官方 Action 安装 pnpm(自动配置 PATH,避免找不到命令)
24- - name : Install pnpm
25- uses : pnpm/action-setup@v4 # 官方 pnpm 安装 Action,稳定可靠
26- with :
27- version : latest # 可指定具体版本(如 9.5.0),推荐 latest 或固定版本
28- run_install : false # 不自动安装依赖,后续手动执行 CI 模式安装
29-
30- - name : Install dependencies (pnpm CI mode)
31- run : pnpm install --frozen-lockfile # 依然用 pnpm 的 CI 模式,等价于 npm ci
21+ cache : npm
3222
23+ - name : Install dependencies
24+ run : npm ci
3325 - name : Build website
34- run : pnpm run build # 统一用 pnpm 执行脚本(也可保留 npm run build,不影响)
26+ run : npm run build
3527
3628 - name : Upload Build Artifact
3729 uses : actions/upload-pages-artifact@v3
@@ -41,12 +33,17 @@ jobs:
4133 deploy :
4234 name : Deploy to GitHub Pages
4335 needs : build
36+
37+ # Grant GITHUB_TOKEN the permissions required to make a Pages deployment
4438 permissions :
45- pages : write
46- id-token : write
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
4743 environment :
4844 name : github-pages
4945 url : ${{ steps.deployment.outputs.page_url }}
46+
5047 runs-on : ubuntu-latest
5148 steps :
5249 - name : Deploy to GitHub Pages
0 commit comments