1- name : Auto Deploy
1+ name : Auto Deploy VitePress (pull latest submodules)
22
33on :
44 push :
5- branches : [main]
5+ branches : [ main ] # 设置源码主分支
66 paths :
77 - ' next-sdk/docs/**'
88 - ' tiny-robot/docs/**'
99 - ' tiny-vue/examples/sites/demos/pc/webdoc/**'
1010 - ' .vitepress/**'
11-
12- workflow_dispatch :
11+ workflow_dispatch : {} # 支持手动触发
1312
1413permissions :
1514 contents : read
@@ -27,14 +26,35 @@ jobs:
2726 - uses : webfactory/ssh-agent@v0.8.0
2827 with :
2928 ssh-private-key : ${{ secrets.SUBMODULE_SSH_KEY }}
30- - name : Checkout
31- uses : actions/checkout@v3
29+ - name : Checkout repository (with submodules)
30+ uses : actions/checkout@v4
31+ with :
32+ fetch-depth : 0 # 推荐完整历史以支持 lastUpdated 等
33+ submodules : recursive # 检出子模块(递归)
34+ persist-credentials : false
35+
36+ - name : Ensure submodules are up-to-date (pull latest from their remote)
37+ # 这一步会把子模块更新到各自远端的最新分支(通常是子模块配置的上游)
38+ run : |
39+ git submodule sync --recursive
40+ git submodule update --init --recursive
41+ # 拉取子模块的远端最新提交(合并到当前子模块工作树)
42+ # 注意:这不会把变化提交回主仓库;仅用于构建时使用最新子模块内容
43+ git submodule update --remote --merge --recursive
44+ # 打印状态便于调试
45+ git submodule status --recursive
46+
47+ - name : Setup Node.js
48+ uses : actions/setup-node@v4
49+ with :
50+ node-version : ' 20'
51+ cache : ' pnpm'
52+
3253 - name : Setup pnpm
3354 uses : pnpm/action-setup@v3
3455 with :
3556 version : 9
36- - name : Clone submodules
37- run : git submodule update --init
57+
3858 - name : Install deps
3959 run : pnpm i
4060 - name : Build site
5979 runs-on : ubuntu-latest
6080 needs : build
6181 steps :
62- - name : Deploy to GitHub Pages
63- id : deployment
64- uses : actions/deploy-pages@v4
82+ - name : Deploy to GitHub Pages
83+ id : deployment
84+ uses : actions/deploy-pages@v4
0 commit comments