Skip to content

Commit 8bbc13c

Browse files
committed
feat: 添加 GitHub Actions 工作流以构建和部署 Rsbuild 站点到 GitHub Pages
1 parent de04d4c commit 8bbc13c

1 file changed

Lines changed: 54 additions & 0 deletions

File tree

.github/workflows/github-pages.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# 用于构建和部署 Rsbuild 站点到 GitHub Pages 的示例工作流
2+
name: Rsbuild Deployment
3+
4+
on:
5+
# 在推送到默认分支时触发
6+
push:
7+
branches: ['main']
8+
# 允许你从 Actions tabs 手动运行这个工作流
9+
workflow_dispatch:
10+
11+
# 设置 GITHUB_TOKEN 的权限以允许部署到 GitHub Pages
12+
permissions:
13+
contents: read
14+
pages: write
15+
id-token: write
16+
17+
# 同时只允许一个部署执行
18+
concurrency:
19+
group: 'pages'
20+
cancel-in-progress: false
21+
22+
jobs:
23+
build:
24+
runs-on: ubuntu-latest
25+
26+
steps:
27+
- name: Checkout
28+
uses: actions/checkout@v4
29+
30+
- name: Use Node.js
31+
uses: actions/setup-node@v4
32+
with:
33+
node-version: 22
34+
35+
- name: Install pnpm
36+
uses: pnpm/action-setup@v4
37+
38+
- name: Install dependencies
39+
run: pnpm i
40+
41+
- name: Build
42+
run: pnpm run build:browser --base /SnapProofPrintHelperForPWA/
43+
44+
- name: Setup Pages
45+
uses: actions/configure-pages@v5
46+
47+
- name: Upload artifact
48+
uses: actions/upload-pages-artifact@v3
49+
with:
50+
path: './dist/browser'
51+
52+
- name: Deploy to GitHub Pages
53+
id: deployment
54+
uses: actions/deploy-pages@v4

0 commit comments

Comments
 (0)