Skip to content

Commit 44fad36

Browse files
authored
Merge pull request #3 from volcengine/feat/deploy-docs
feat(ci): support vitepress deployment on github pages
2 parents d2f7315 + 62e0113 commit 44fad36

17 files changed

+2495
-28754
lines changed

.github/workflow/deploy-docs.yaml

Lines changed: 0 additions & 71 deletions
This file was deleted.

.github/workflows/deploy-docs.yml

Lines changed: 27 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -3,69 +3,54 @@
33
name: Deploy VitePress site to Pages
44

55
on:
6-
# 在针对 `main` 分支的推送上运行。如果你
7-
# 使用 `master` 分支作为默认分支,请将其更改为 `master`
86
push:
97
branches:
108
- main
119
- feat/docs
1210
paths:
1311
- 'docs/**'
14-
- '.github/workflows/deploy-docs.yaml'
12+
- '.github/workflows/deploy-docs.yml'
1513

1614
# 允许你从 Actions 选项卡手动运行此工作流程
1715
workflow_dispatch:
1816

19-
# 设置 GITHUB_TOKEN 的权限,以允许部署到 GitHub Pages
2017
permissions:
21-
contents: read
22-
pages: write
23-
id-token: write
24-
25-
# 只允许同时进行一次部署,跳过正在运行和最新队列之间的运行队列
26-
# 但是,不要取消正在进行的运行,因为我们希望允许这些生产部署完成
27-
concurrency:
28-
group: pages
29-
cancel-in-progress: false
18+
contents: write
3019

3120
jobs:
32-
# 构建工作
33-
build:
21+
build-and-deploy:
3422
runs-on: ubuntu-latest
3523
steps:
3624
- name: Checkout
3725
uses: actions/checkout@v5
3826
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,请取消注释
27+
fetch-depth: 0
28+
4429
- name: Setup Node
4530
uses: actions/setup-node@v6
4631
with:
47-
node-version: 24
48-
cache: npm # 或 pnpm / yarn
49-
- name: Setup Pages
50-
uses: actions/configure-pages@v4
32+
node-version: '22'
33+
5134
- name: Install dependencies
52-
run: npm ci # 或 pnpm install / yarn install / bun install
35+
run: |
36+
cd docs
37+
echo "Check current directory"
38+
pwd
39+
npm ci
40+
5341
- 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
42+
run: |
43+
cd docs
44+
echo "Check current directory"
45+
pwd
46+
npm run docs:build
47+
48+
- name: Deploy to feat/deploy
49+
uses: peaceiris/actions-gh-pages@v3
5750
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
51+
github_token: ${{ secrets.REPO_TOKEN }}
52+
publish_dir: docs/.vitepress/dist
53+
publish_branch: feat/deploy
54+
user_name: 'github-actions[bot]'
55+
user_email: 'github-actions[bot]@users.noreply.github.com'
56+
commit_message: 'Deploy docs to feat/deploy'

.gitignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,6 @@ cython_debug/
167167
uv.lock
168168

169169
# VitePress related files (security concern - keep Markdown docs in repo)
170-
171-
docs/package-lock.json
172170
docs/node_modules/
173171

174172
# local test files

0 commit comments

Comments
 (0)