File tree Expand file tree Collapse file tree 3 files changed +94
-0
lines changed
Expand file tree Collapse file tree 3 files changed +94
-0
lines changed Original file line number Diff line number Diff line change 1+ name : Auto Build Main Module Docs
2+
3+ on :
4+ pull_request :
5+ branches : [release/v0.3.x]
6+ paths :
7+ - ' docs/**'
8+ push :
9+ branches : [release/v0.3.x]
10+ paths :
11+ - ' docs/**'
12+
13+ jobs :
14+ verify-main-build :
15+ runs-on : ubuntu-latest
16+ permissions :
17+ contents : read
18+ pull-requests : write
19+
20+ steps :
21+ -
uses :
webfactory/[email protected] 22+ with :
23+ ssh-private-key : ${{ secrets.SUBMODULE_SSH_KEY_PRIVATE }}
24+ - name : Checkout submodule repo
25+ uses : actions/checkout@v4
26+ with :
27+ fetch-depth : 0
28+ token : ${{ secrets.PAT_TOKEN }}
29+
30+ - name : Checkout main repository
31+ run : |
32+ # 克隆主仓库
33+ git clone https://github.com/opentiny/docs.git docs-main
34+ cd docs-main
35+
36+ # 更新子模块到PR分支的版本
37+ git submodule sync --recursive
38+ git submodule update --init --recursive
39+
40+
41+ # 获取PR分支的最新提交
42+ cd ./tiny-robot
43+ BRANCH_NAME="${{ github.head_ref }}"
44+ git fetch origin $BRANCH_NAME
45+ git checkout $BRANCH_NAME
46+
47+ # 回到主仓库根目录
48+ cd ../
49+
50+ - name : Setup pnpm
51+ uses : pnpm/action-setup@v3
52+ with :
53+ version : 9
54+
55+ - name : Run main repo build
56+ id : build
57+ working-directory : ./docs-main
58+ run : |
59+ pnpm i
60+ # 如果使用VitePress
61+ pnpm build
62+
63+ - name : Update PR status
64+ if : always()
65+ run : |
66+ # 检查构建是否成功
67+ if [ ${{ steps.build.outcome }} == 'success' ]; then
68+ echo "✅ 主仓库构建成功"
69+ else
70+ echo "❌ 主仓库构建失败"
71+ exit 1
72+ fi
Original file line number Diff line number Diff line change 1+ name : Auto Deploy Docs
2+
3+ on :
4+ push :
5+ branches : [release/v0.3.x]
6+ paths :
7+ - ' docs/**'
8+
9+ jobs :
10+ notify :
11+ runs-on : ubuntu-latest
12+ steps :
13+ - name : Trigger main repo workflow
14+ env :
15+ PAT : ${{ secrets.PAT_TOKEN }}
16+ run : |
17+ curl -X POST \
18+ -H "Authorization: token $PAT" \
19+ -H "Accept: application/vnd.github.v3+json" \
20+ https://api.github.com/repos/opentiny/docs/dispatches \
21+ -d '{"event_type":"submodule-updated"}'
Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ TinyRobot 文档支持在 Markdown 表格中添加版本标记,用于标识属
99在 ` .vitepress/config.mts ` 中配置 ` MarkdownBadgePlugin ` 以支持文档内容中的版本标记:
1010
1111``` typescript
12+
1213import { defineConfig } from ' vitepress'
1314import { MarkdownBadgePlugin } from ' ./.vitepress/plugins/badge'
1415
You can’t perform that action at this time.
0 commit comments