File tree Expand file tree Collapse file tree 1 file changed +68
-0
lines changed
Expand file tree Collapse file tree 1 file changed +68
-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 : [dev]
6+ push :
7+ branches : [dev]
8+
9+ jobs :
10+ verify-main-build :
11+ runs-on : ubuntu-latest
12+ permissions :
13+ contents : read
14+ pull-requests : write
15+
16+ steps :
17+ - uses : webfactory/ssh-agent@v0.8.0
18+ with :
19+ ssh-private-key : ${{ secrets.SUBMODULE_SSH_KEY_PRIVATE }}
20+ - name : Checkout submodule repo
21+ uses : actions/checkout@v4
22+ with :
23+ fetch-depth : 0
24+ token : ${{ secrets.PAT_TOKEN }}
25+
26+ - name : Checkout main repository
27+ run : |
28+ # 克隆主仓库
29+ git clone https://github.com/opentiny/docs.git docs
30+ cd docs
31+
32+ # 更新子模块到PR分支的版本
33+ git submodule sync --recursive
34+ git submodule update --init --recursive
35+
36+
37+ # 获取PR分支的最新提交
38+ cd ./tiny-vue
39+ BRANCH_NAME="${{ github.head_ref }}"
40+ git fetch origin $BRANCH_NAME
41+ git checkout $BRANCH_NAME
42+
43+ # 回到主仓库根目录
44+ cd ../
45+
46+ - name : Setup pnpm
47+ uses : pnpm/action-setup@v3
48+ with :
49+ version : 9
50+
51+ - name : Run main repo build
52+ id : build
53+ working-directory : ./docs
54+ run : |
55+ pnpm i
56+ # 如果使用VitePress
57+ pnpm build
58+
59+ - name : Update PR status
60+ if : always()
61+ run : |
62+ # 检查构建是否成功
63+ if [ ${{ steps.build.outcome }} == 'success' ]; then
64+ echo "✅ 主仓库构建成功"
65+ else
66+ echo "❌ 主仓库构建失败"
67+ exit 1
68+ fi
You can’t perform that action at this time.
0 commit comments