@@ -38,14 +38,15 @@ jobs:
3838 echo "should_publish=true" >> "$GITHUB_OUTPUT"
3939 fi
4040
41- # ── Step 2: Build and stage all artifacts (3 runners, 2 targets each) ─
41+ # ── Step 2: Build and stage native artifacts (3 runners, 2 targets each) ─
4242 #
43- # Each runner builds native + cross targets, then runs full publish-stage
44- # to produce a complete publish/ folder for its platforms.
43+ # Each runner builds native + cross targets, then stages only the native files
44+ # for its platforms into package/runtime directories. The release job later
45+ # merges those staged files and packs npm/NuGet/crates/WASM once on Linux.
4546 #
46- # ubuntu-latest (x64) → linux-x64 + linux-arm64
47- # macos-latest (arm) → darwin-arm64 + darwin-x64
48- # windows-latest (x64) → win32-x64 + win32-arm64
47+ # ubuntu-latest (x64) → linux-x64 + linux-arm64
48+ # macos-latest-large (arm) → darwin-arm64 + darwin-x64
49+ # windows-latest (x64) → win32-x64 + win32-arm64
4950
5051 build-linux :
5152 name : Build (Linux x64 + arm64)
5859 with :
5960 shared-cache-key : publish-linux
6061 rust-targets : x86_64-unknown-linux-gnu, aarch64-unknown-linux-gnu
61- dotnet : ' 8.0.x'
6262 skip-build : ' true'
6363
6464 - name : Install cross-compilation tools (arm64 linker)
@@ -82,28 +82,32 @@ jobs:
8282 -p microsoft-webui-ffi
8383 -p microsoft-webui-node
8484
85- - name : Stage all artifacts
86- run : cargo xtask publish-stage --target all --profile release
85+ - name : Stage native artifacts
86+ run : cargo xtask publish-stage --target all --profile release --native-only
8787
88- - name : Upload publish folder
88+ - name : Upload staged native assets
8989 uses : actions/upload-artifact@v4
9090 with :
91- name : publish-linux
92- path : publish/
91+ name : stage-linux
92+ path : |
93+ publish/native/
94+ packages/webui-linux-x64/
95+ packages/webui-linux-arm64/
96+ dotnet/runtimes/linux-x64/
97+ dotnet/runtimes/linux-arm64/
9398 retention-days : 1
9499
95100 build-macos :
96101 name : Build (macOS arm64 + x64)
97102 needs : check-version
98103 if : needs.check-version.outputs.should_publish == 'true'
99- runs-on : macos-latest
104+ runs-on : macos-latest-large
100105 steps :
101106 - uses : actions/checkout@v4
102107 - uses : ./.github/actions/build
103108 with :
104109 shared-cache-key : publish-macos
105110 rust-targets : aarch64-apple-darwin, x86_64-apple-darwin
106- dotnet : ' 8.0.x'
107111 skip-build : ' true'
108112
109113 - name : Build arm64 (native)
@@ -122,14 +126,19 @@ jobs:
122126 -p microsoft-webui-ffi
123127 -p microsoft-webui-node
124128
125- - name : Stage all artifacts
126- run : cargo xtask publish-stage --target all --profile release
129+ - name : Stage native artifacts
130+ run : cargo xtask publish-stage --target all --profile release --native-only
127131
128- - name : Upload publish folder
132+ - name : Upload staged native assets
129133 uses : actions/upload-artifact@v4
130134 with :
131- name : publish-macos
132- path : publish/
135+ name : stage-macos
136+ path : |
137+ publish/native/
138+ packages/webui-darwin-arm64/
139+ packages/webui-darwin-x64/
140+ dotnet/runtimes/osx-arm64/
141+ dotnet/runtimes/osx-x64/
133142 retention-days : 1
134143
135144 build-windows :
@@ -143,7 +152,6 @@ jobs:
143152 with :
144153 shared-cache-key : publish-windows
145154 rust-targets : x86_64-pc-windows-msvc, aarch64-pc-windows-msvc
146- dotnet : ' 8.0.x'
147155 skip-build : ' true'
148156
149157 - name : Build x64 (native)
@@ -162,17 +170,22 @@ jobs:
162170 -p microsoft-webui-ffi
163171 -p microsoft-webui-node
164172
165- - name : Stage all artifacts
166- run : cargo xtask publish-stage --target all --profile release
173+ - name : Stage native artifacts
174+ run : cargo xtask publish-stage --target all --profile release --native-only
167175
168- - name : Upload publish folder
176+ - name : Upload staged native assets
169177 uses : actions/upload-artifact@v4
170178 with :
171- name : publish-windows
172- path : publish/
179+ name : stage-windows
180+ path : |
181+ publish/native/
182+ packages/webui-win32-x64/
183+ packages/webui-win32-arm64/
184+ dotnet/runtimes/win-x64/
185+ dotnet/runtimes/win-arm64/
173186 retention-days : 1
174187
175- # ── Step 3: Merge artifacts, tag, and create release ─────────────── ───
188+ # ── Step 3: Merge native assets, pack once, tag, and create release ───
176189 release :
177190 name : Create Release
178191 needs : [check-version, build-linux, build-macos, build-windows]
@@ -182,14 +195,35 @@ jobs:
182195 with :
183196 fetch-depth : 0
184197
185- # Download and merge all publish/ folders from the 3 runners
186- - name : Download all publish artifacts
198+ - uses : ./.github/actions/build
199+ with :
200+ shared-cache-key : publish-release
201+ dotnet : ' 8.0.x'
202+ skip-build : ' true'
203+
204+ # Download and merge all staged native assets from the 3 runners
205+ - name : Download staged native artifacts
187206 uses : actions/download-artifact@v4
188207 with :
189- pattern : publish -*
190- path : publish/
208+ pattern : stage -*
209+ path : .
191210 merge-multiple : true
192211
212+ - name : Setup WASM C headers
213+ shell : bash
214+ run : |
215+ cargo fetch
216+ WASM_HEADERS=$(find $HOME/.cargo/registry/src -path "*/tree-sitter-language-*/wasm/include" -type d | head -1)
217+ if [ -n "$WASM_HEADERS" ]; then
218+ echo "WASI_INCLUDE=$WASM_HEADERS" >> $GITHUB_ENV
219+ else
220+ echo "::error::Could not find tree-sitter-language WASM headers after cargo fetch"
221+ exit 1
222+ fi
223+
224+ - name : Pack unified release artifacts
225+ run : cargo xtask publish-stage --pack-only --profile release
226+
193227 # List all artifacts for verification
194228 - name : List publish artifacts
195229 run : find publish/ -type f | sort
0 commit comments