1- name : Build Playground
1+ name : Build and Deploy Playground
22
33on :
44 push :
1313 - ' package.json'
1414 - ' .github/workflows/playground.yml'
1515
16+ # 设置 GITHUB_TOKEN 的权限,以允许部署到 GitHub Pages
17+ permissions :
18+ contents : read
19+ pages : write
20+ id-token : write
21+
22+ # 只允许一次部署,跳过正在运行的部署队列中的运行
23+ concurrency :
24+ group : " pages"
25+ cancel-in-progress : false
26+
1627jobs :
1728 build :
1829 runs-on : ubuntu-latest
19-
2030 steps :
21- - uses : actions/checkout@v2
31+ - name : Checkout
32+ uses : actions/checkout@v4
2233
2334 - name : Install pnpm
24- uses : pnpm/action-setup@v2
35+ uses : pnpm/action-setup@v4
36+ with :
37+ version : 10.10.0
2538
2639 - name : Setup Node.js
27- uses : actions/setup-node@v2
40+ uses : actions/setup-node@v4
2841 with :
29- node-version : ' 18 ' # 使用适合你项目的Node.js版本
42+ node-version : ' 20.18.1 ' # 与 volta 配置保持一致
3043 cache : ' pnpm'
3144
32- - run : pnpm i
45+ - name : Setup Pages
46+ uses : actions/configure-pages@v5
47+
48+ - name : Install dependencies
49+ run : pnpm install
3350
3451 - name : Build Playground
3552 run : pnpm build --filter=playground
3653
3754 # - name: Build docs
3855 # run: pnpm build --filter=project-docs
3956
40- - name : mkdir dist
41- run : mkdir dist && mkdir dist/playground
42- # run: mkdir dist && mkdir dist/docs && mkdir dist/playground
43-
44- - name : move to dist
45- run : mv apps/playground/dist/* dist/playground
46- # run: mv docs/project-docs/dist/* dist/docs && mv apps/playground/dist/* dist/playground
47-
48- - name : Deploy to GitHub Pages
49- uses : crazy-max/ghaction-github-pages@v2
57+ - name : Upload artifact
58+ uses : actions/upload-pages-artifact@v3
5059 with :
51- target_branch : gh-pages
52- build_dir : dist
53- env :
54- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
60+ path : ./apps/playground/dist
61+
62+ # 部署任务
63+ deploy :
64+ environment :
65+ name : github-pages
66+ url : ${{ steps.deployment.outputs.page_url }}
67+ runs-on : ubuntu-latest
68+ needs : build
69+ steps :
70+ - name : Deploy to GitHub Pages
71+ id : deployment
72+ uses : actions/deploy-pages@v4
0 commit comments