Skip to content

Commit aabac2c

Browse files
committed
feat: implement separate GitHub Actions workflows for deploying English and Chinese documentation to GitHub Pages
- Added `deploy-docs-en.yml` for English documentation deployment. - Added `deploy-docs-zh.yml` for Chinese documentation deployment. - Removed the consolidated `deploy-docs.yml` workflow.
1 parent 237995b commit aabac2c

3 files changed

Lines changed: 98 additions & 77 deletions

File tree

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Deploy English Docs to gh-pages
2+
3+
on:
4+
push:
5+
branches: [main, master, feature/opt]
6+
paths:
7+
- 'nextra-docs-en/**'
8+
- '.github/workflows/deploy-docs-en.yml'
9+
workflow_dispatch:
10+
11+
# 设置权限
12+
permissions:
13+
contents: write # 需要写权限以推送到 gh-pages 分支
14+
15+
jobs:
16+
deploy:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@v4
21+
with:
22+
fetch-depth: 0 # 需要完整历史记录
23+
24+
- name: Setup Node.js
25+
uses: actions/setup-node@v4
26+
with:
27+
node-version: '20'
28+
cache: 'npm'
29+
cache-dependency-path: 'nextra-docs-en/package-lock.json'
30+
31+
- name: Install dependencies
32+
run: |
33+
cd nextra-docs-en
34+
npm ci --force
35+
36+
- name: Build English docs
37+
run: |
38+
cd nextra-docs-en
39+
npm run build
40+
41+
- name: Deploy to gh-pages branch (en directory)
42+
uses: peaceiris/actions-gh-pages@v3
43+
with:
44+
github_token: ${{ secrets.GITHUB_TOKEN }}
45+
publish_dir: ./nextra-docs-en/out
46+
publish_branch: gh-pages
47+
destination_dir: en
48+
keep_files: true # 保留其他目录的文件(如 zh 目录)
49+
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Deploy Chinese Docs to gh-pages
2+
3+
on:
4+
push:
5+
branches: [main, master, feature/opt]
6+
paths:
7+
- 'nextra-docs-zh/**'
8+
- '.github/workflows/deploy-docs-zh.yml'
9+
workflow_dispatch:
10+
11+
# 设置权限
12+
permissions:
13+
contents: write # 需要写权限以推送到 gh-pages 分支
14+
15+
jobs:
16+
deploy:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@v4
21+
with:
22+
fetch-depth: 0 # 需要完整历史记录
23+
24+
- name: Setup Node.js
25+
uses: actions/setup-node@v4
26+
with:
27+
node-version: '20'
28+
cache: 'npm'
29+
cache-dependency-path: 'nextra-docs-zh/package-lock.json'
30+
31+
- name: Install dependencies
32+
run: |
33+
cd nextra-docs-zh
34+
npm ci --force
35+
36+
- name: Build Chinese docs
37+
run: |
38+
cd nextra-docs-zh
39+
npm run build
40+
41+
- name: Deploy to gh-pages branch (zh directory)
42+
uses: peaceiris/actions-gh-pages@v3
43+
with:
44+
github_token: ${{ secrets.GITHUB_TOKEN }}
45+
publish_dir: ./nextra-docs-zh/out
46+
publish_branch: gh-pages
47+
destination_dir: zh
48+
keep_files: true # 保留其他目录的文件(如 en 目录)
49+

.github/workflows/deploy-docs.yml

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

0 commit comments

Comments
 (0)