Skip to content

Commit 1f2c503

Browse files
committed
feat: support vitepress deployment on github pages
1 parent ecca4d5 commit 1f2c503

18 files changed

+25638
-8
lines changed

.github/workflow/deploy-docs.yaml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# 构建 VitePress 站点并将其部署到 GitHub Pages 的示例工作流程
2+
#
3+
name: Deploy VitePress site to Pages
4+
5+
on:
6+
# 在针对 `main` 分支的推送上运行。如果你
7+
# 使用 `master` 分支作为默认分支,请将其更改为 `master`
8+
push:
9+
branches:
10+
- main
11+
- feat/docs
12+
paths:
13+
- 'docs/**'
14+
- '.github/workflows/deploy-docs.yaml'
15+
16+
# 允许你从 Actions 选项卡手动运行此工作流程
17+
workflow_dispatch:
18+
19+
# 设置 GITHUB_TOKEN 的权限,以允许部署到 GitHub Pages
20+
permissions:
21+
contents: read
22+
pages: write
23+
id-token: write
24+
25+
# 只允许同时进行一次部署,跳过正在运行和最新队列之间的运行队列
26+
# 但是,不要取消正在进行的运行,因为我们希望允许这些生产部署完成
27+
concurrency:
28+
group: pages
29+
cancel-in-progress: false
30+
31+
jobs:
32+
# 构建工作
33+
build:
34+
runs-on: ubuntu-latest
35+
steps:
36+
- name: Checkout
37+
uses: actions/checkout@v5
38+
with:
39+
fetch-depth: 0 # 如果未启用 lastUpdated,则不需要
40+
# - uses: pnpm/action-setup@v4 # 如果使用 pnpm,请取消此区域注释
41+
# with:
42+
# version: 9
43+
# - uses: oven-sh/setup-bun@v1 # 如果使用 Bun,请取消注释
44+
- name: Setup Node
45+
uses: actions/setup-node@v6
46+
with:
47+
node-version: 24
48+
cache: npm # 或 pnpm / yarn
49+
- name: Setup Pages
50+
uses: actions/configure-pages@v4
51+
- name: Install dependencies
52+
run: npm ci # 或 pnpm install / yarn install / bun install
53+
- name: Build with VitePress
54+
run: npm run docs:build # 或 pnpm docs:build / yarn docs:build / bun run docs:build
55+
- name: Upload artifact
56+
uses: actions/upload-pages-artifact@v3
57+
with:
58+
path: docs/.vitepress/dist
59+
60+
# 部署工作
61+
deploy:
62+
environment:
63+
name: github-pages
64+
url: ${{ steps.deployment.outputs.page_url }}
65+
needs: build
66+
runs-on: ubuntu-latest
67+
name: Deploy
68+
steps:
69+
- name: Deploy to GitHub Pages
70+
id: deployment
71+
uses: actions/deploy-pages@v4

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ cython_debug/
167167
uv.lock
168168

169169
# VitePress related files (security concern - keep Markdown docs in repo)
170-
docs/package.json
170+
171171
docs/package-lock.json
172172
docs/node_modules/
173173

docs/.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,3 @@ node_modules
22
.vitepress/cache
33
.vitepress/dist
44
package-lock.json
5-
package.json
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"hash": "bd82e864",
3+
"configHash": "82d8e97e",
4+
"lockfileHash": "af04ab03",
5+
"browserHash": "a726e73b",
6+
"optimized": {
7+
"vue": {
8+
"src": "../../../../node_modules/vue/dist/vue.runtime.esm-bundler.js",
9+
"file": "vue.js",
10+
"fileHash": "4235b90c",
11+
"needsInterop": false
12+
},
13+
"vitepress > @vue/devtools-api": {
14+
"src": "../../../../node_modules/@vue/devtools-api/dist/index.js",
15+
"file": "vitepress___@vue_devtools-api.js",
16+
"fileHash": "923481af",
17+
"needsInterop": false
18+
},
19+
"vitepress > @vueuse/core": {
20+
"src": "../../../../node_modules/@vueuse/core/dist/index.js",
21+
"file": "vitepress___@vueuse_core.js",
22+
"fileHash": "ee4e3675",
23+
"needsInterop": false
24+
}
25+
},
26+
"chunks": {
27+
"chunk-VNBOKC53": {
28+
"file": "chunk-VNBOKC53.js"
29+
}
30+
}
31+
}

0 commit comments

Comments
 (0)