-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathauto-build-main-module-docs.yml
More file actions
72 lines (61 loc) · 1.69 KB
/
auto-build-main-module-docs.yml
File metadata and controls
72 lines (61 loc) · 1.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
name: Auto Build Main Module Docs
on:
pull_request:
branches: [release/v0.3.x]
paths:
- 'docs/**'
push:
branches: [release/v0.3.x]
paths:
- 'docs/**'
jobs:
verify-main-build:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- uses: webfactory/ssh-agent@v0.8.0
with:
ssh-private-key: ${{ secrets.SUBMODULE_SSH_KEY_PRIVATE }}
- name: Checkout submodule repo
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.PAT_TOKEN }}
- name: Checkout main repository
run: |
# 克隆主仓库
git clone https://github.com/opentiny/docs.git docs-main
cd docs-main
# 更新子模块到PR分支的版本
git submodule sync --recursive
git submodule update --init --recursive
# 获取PR分支的最新提交
cd ./tiny-robot
BRANCH_NAME="${{ github.head_ref }}"
git fetch origin $BRANCH_NAME
git checkout $BRANCH_NAME
# 回到主仓库根目录
cd ../
- name: Setup pnpm
uses: pnpm/action-setup@v3
with:
version: 9
- name: Run main repo build
id: build
working-directory: ./docs-main
run: |
pnpm i
# 如果使用VitePress
pnpm build
- name: Update PR status
if: always()
run: |
# 检查构建是否成功
if [ ${{ steps.build.outcome }} == 'success' ]; then
echo "✅ 主仓库构建成功"
else
echo "❌ 主仓库构建失败"
exit 1
fi