@@ -18,6 +18,13 @@ concurrency:
1818jobs :
1919 build :
2020 runs-on : ubuntu-latest
21+ strategy :
22+ matrix :
23+ include :
24+ - batch : main
25+ env_mode : main
26+ - batch : zh-variants
27+ env_mode : zh-variants
2128
2229 steps :
2330 - name : 📥 Checkout code
@@ -40,16 +47,59 @@ jobs:
4047 - name : 📦 Install dependencies
4148 run : pnpm install --frozen-lockfile
4249
43- - name : 🏗️ Build VitePress
44- run : pnpm docs:build
50+ - name : 💾 Cache VitePress build
51+ uses : actions/cache@v4
52+ with :
53+ path : docs/.vitepress/cache
54+ key : vitepress-${{ matrix.batch }}-${{ hashFiles('docs/**/*.md') }}
55+ restore-keys : |
56+ vitepress-${{ matrix.batch }}-
57+
58+ - name : Pre-compute article metadata
59+ run : node scripts/precompute-meta.js
60+
61+ - name : " 🔨 Build (${{ matrix.batch }})"
62+ run : pnpm exec vitepress build docs
63+ env :
64+ BUILD_MODE : ${{ matrix.env_mode }}
65+ NODE_OPTIONS : --max-old-space-size=4096
66+
67+ - name : 📤 Upload build artifact
68+ uses : actions/upload-artifact@v4
69+ with :
70+ name : dist-${{ matrix.batch }}
71+ path : docs/.vitepress/dist${{ matrix.batch == 'zh-variants' && '-zh-variants' || '' }}
4572
46- - name : 📤 Upload artifact
73+ merge-and-deploy :
74+ needs : build
75+ runs-on : ubuntu-latest
76+
77+ steps :
78+ - name : 📥 Checkout code
79+ uses : actions/checkout@v4
80+
81+ - name : 📥 Download main dist
82+ uses : actions/download-artifact@v4
83+ with :
84+ name : dist-main
85+ path : docs/.vitepress/dist
86+
87+ - name : 📥 Download zh-variants dist
88+ uses : actions/download-artifact@v4
89+ with :
90+ name : dist-zh-variants
91+ path : docs/.vitepress/dist-zh-variants
92+
93+ - name : 🔀 Merge builds
94+ run : node docs/.vitepress/merge-builds.js
95+
96+ - name : 📤 Upload pages artifact
4797 uses : actions/upload-pages-artifact@v3
4898 with :
4999 path : docs/.vitepress/dist
50100
51101 deploy :
52- needs : build
102+ needs : merge-and-deploy
53103 runs-on : ubuntu-latest
54104 environment :
55105 name : github-pages
0 commit comments