Skip to content

Commit f700106

Browse files
committed
feat(workflow): 添加 GitHub Pages 部署工作流
1 parent 3b41fca commit f700106

1 file changed

Lines changed: 51 additions & 0 deletions

File tree

.github/workflows/build.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Deploy WebUI to GitHub Pages
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: write
11+
12+
jobs:
13+
build:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: 检出仓库
17+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
18+
19+
- name: 设置 Nodejs
20+
uses: puniyu/setup-node@main
21+
with:
22+
node-version: lts/*
23+
pnpm-version: latest
24+
cache: ${{ inputs.cache }}
25+
26+
- name: 构建 WebUI
27+
run: |
28+
pnpm install
29+
pnpm run build
30+
31+
- name: 上传构建产物
32+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
33+
with:
34+
name: webui
35+
path: dist
36+
37+
deploy:
38+
runs-on: ubuntu-latest
39+
needs: build
40+
steps:
41+
- name: 下载构建产物
42+
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
43+
with:
44+
name: webui
45+
path: dist
46+
47+
- name: 部署
48+
uses: peaceiris/actions-gh-pages@v4
49+
with:
50+
github_token: ${{ secrets.GITHUB_TOKEN }}
51+
publish_dir: ./dist

0 commit comments

Comments
 (0)