Skip to content

Record your screen, ship a demo. Free and open-source, GPU-accelerated, no watermarks, no subscriptions. Windows, macOS, Linux. Actively maintained.

ci: build the Windows arm64 installer natively and publish one update feed for both arches

Christian Schmittel40ec572b4321
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 937d1df00..f9ef0166c 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -43,7 +43,13 @@ concurrency:
jobs:
build-windows:
name: Windows ${{ matrix.arch }} installer
- runs-on: windows-latest
+ # Each arch builds NATIVELY, like the macOS job below. On an x64 runner every step
+ # that keys off the host — fetch-ffmpeg (which also runs the binary it downloads to
+ # verify the licence), fetch-onnxruntime, the compositor's cargo build — produced x64
+ # output for the arm64 package, and before-pack then refused it. On windows-11-arm
+ # `process.arch` is arm64 and the same steps that build the arm64 installer on a
+ # Snapdragon desktop run unchanged.
+ runs-on: ${{ matrix.arch == 'arm64' && 'windows-11-arm' || 'windows-latest' }}
strategy:
fail-fast: false
matrix:
@@ -74,16 +80,14 @@ jobs:
Write-Host "MSVC ARM64 build tools already present."
}
- - name: Ensure win32-arm64 sharp binary
- # sharp (transitive via @xenova/transformers) only fetches a host-arch
- # prebuilt at install time, so on the x64 runner the packaged arm64 app
- # would otherwise ship an x64 sharp.node. Best-effort fetch of the
- # win32-arm64 prebuilt; non-fatal so it never blocks the build. Verify
- # the first arm64 release loads sharp if auto-captions use it.
- if: matrix.arch == 'arm64'
- continue-on-error: true
+ # Everything below resolves its target from the host. Should this job ever land on an
+ # x64 runner again, fail here rather than after a full build that before-pack rejects.
+ - name: Check the runner architecture
shell: bash
- run: npm_config_platform=win32 npm_config_arch=arm64 npm rebuild sharp
+ run: |
+ HOST="$(node -p process.arch)"
+ [ "$HOST" = "${{ matrix.arch }}" ] \
+ || { echo "::error::the ${{ matrix.arch }} installer must build on a ${{ matrix.arch }} runner, got $HOST"; exit 1; }
- name: Cache caption assets
uses: actions/cache@v4
@@ -103,8 +107,8 @@ jobs:
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# win32-x64 for BOTH arches, deliberately: build-whisper-stt.yml produces no
- # arm64 helper (scripts/build-whisper-stt.sh has no win32-arm64 acceleration
- # case at all), so an arch-parameterised tag would simply fail the arm64 job.
+ # arm64 helper yet (scripts/build-whisper-stt.sh can build one natively on ARM,
+ # but no workflow runs it), so an arch-parameterised tag would fail the arm64 job.
# `candidateBinaryPaths` falls back to the win32-x64 directory on Windows on
# ARM, where the x64 helper runs under emulation — verified on a Snapdragon X
# Elite, Vulkan on the Adreno included. Point this at win32-arm64 the moment a
@@ -119,28 +123,43 @@ jobs:
if: matrix.arch == 'arm64'
run: npm run build:win:arm64 -- --publish never
+ # electron-builder writes a latest.yml per job that lists only that job's installer, and
+ # both land on the same path in the release — the second would overwrite the first and
+ # serve one arch the other's build. Same problem, same fix as macOS: each job describes
+ # its installer in a JSON sidecar and publish-release folds both into ONE latest.yml.
+ # latest.yml is still required here: it proves electron-builder's publish config
+ # produced a feed at all.
+ - name: Describe the installer for the update feed
+ shell: bash
+ run: |
+ test -f "$(find release -name latest.yml | head -1)" \
+ || { echo "::error::latest.yml missing — electron-updater has no feed to read"; exit 1; }
+ EXE="$(find release -name 'Openscreen.Setup.*-${{ matrix.arch }}.exe' | head -1)"
+ test -f "$EXE" \
+ || { echo "::error::no ${{ matrix.arch }} installer under release/"; exit 1; }
+ VERSION="$(node -p "require('./package.json').version")"
+ node scripts/mac-update-feed.mjs describe "$EXE" "$VERSION" \
+ "$(dirname "$EXE")/update-info-win-${{ matrix.arch }}.json"
+
- name: Upload Windows installer
uses: actions/upload-artifact@v7
with:
name: openscreen-windows-${{ matrix.arch }}
- # latest.yml is the update feed electron-updater reads; the .blockmap is what lets it
- # download a delta instead of the full ~243 MB installer. Both were already produced
- # by every build and thrown away here, because this glob only matched the .exe.
+ # The sidecar becomes latest.yml in publish-release; the .blockmap is what lets
+ # electron-updater download a delta instead of the full ~243 MB installer.
path: |
release/**/Openscreen.Setup.*.exe
release/**/Openscreen.Setup.*.exe.blockmap
- release/**/latest.yml
+ release/**/update-info-win-*.json
if-no-files-found: error
retention-days: 30
# `if-no-files-found: error` evaluates the UNION of the globs above, so a dead pattern
# among live ones never fails — that is exactly how the *.zsync glob rotted unnoticed on
- # the Linux job. Assert the update feed specifically.
- - name: Verify the update feed was produced
+ # the Linux job. Assert the blockmap specifically.
+ - name: Verify the blockmap was produced
shell: bash
run: |
- test -f "$(find release -name latest.yml | head -1)" \
- || { echo "::error::latest.yml missing — electron-updater has no feed to read"; exit 1; }
test -f "$(find release -name 'Openscreen.Setup.*.exe.blockmap' | head -1)" \
|| { echo "::error::blockmap missing — differential updates would silently degrade"; exit 1; }
@@ -919,12 +938,20 @@ jobs:
echo "prerelease_flag=$PRERELEASE_FLAG" >> "$GITHUB_OUTPUT"
echo "notes_start_tag=$NOTES_START_TAG" >> "$GITHUB_OUTPUT"
- - name: Download Windows installer
+ # By name, not `pattern: openscreen-windows-*`: that pattern also matches
+ # openscreen-windows-store, and publish-release does not wait for the Store job, so
+ # whether its .appx reached the GitHub release depended on which job finished first.
+ - name: Download Windows x64 installer
uses: actions/download-artifact@v8
with:
- pattern: openscreen-windows-*
- merge-multiple: true
- path: artifacts/windows
+ name: openscreen-windows-x64
+ path: artifacts/windows-x64
+
+ - name: Download Windows arm64 installer
+ uses: actions/download-artifact@v8
+ with:
+ name: openscreen-windows-arm64
+ path: artifacts/windows-arm64
- name: Download macOS arm64 DMG
uses: actions/download-artifact@v8
@@ -964,6 +991,22 @@ jobs:
grep -q 'arm64' artifacts/latest-mac.yml \
|| { echo "::error::latest-mac.yml has no arm64 entry — Apple Silicon would update onto the Intel build"; exit 1; }
+ # Same fold for Windows (see "Describe the installer for the update feed"). The feed's
+ # arch-blind `path:` points at x64, which Windows on ARM still runs under emulation.
+ - name: Build the Windows update feed
+ run: |
+ X64_INFO="$(find artifacts/windows-x64 -name update-info-win-x64.json)"
+ ARM64_INFO="$(find artifacts/windows-arm64 -name update-info-win-arm64.json)"
+ node scripts/mac-update-feed.mjs merge "$X64_INFO" "$ARM64_INFO" artifacts/latest.yml
+ rm -f "$X64_INFO" "$ARM64_INFO"
+ ENTRIES="$(grep -c '^ - url:' artifacts/latest.yml)"
+ [ "$ENTRIES" -eq 2 ] \
+ || { echo "::error::latest.yml lists ${ENTRIES} installers, expected 2 (one per arch)"; exit 1; }
+ grep -q '^ - url: .*-x64\.exe$' artifacts/latest.yml \
+ || { echo "::error::latest.yml has no x64 installer"; exit 1; }
+ grep -q '^ - url: .*-arm64\.exe$' artifacts/latest.yml \
+ || { echo "::error::latest.yml has no arm64 installer"; exit 1; }
+
- name: Publish release assets
env:
GH_TOKEN: ${{ secrets.OPENSCREEN_RELEASE_TOKEN }}
diff --git a/electron/native/README.md b/electron/native/README.md
index 7681cc7fc..1d94526c7 100644
--- a/electron/native/README.md
+++ b/electron/native/README.md
@@ -54,6 +54,8 @@ node scripts/build-windows-wgc-helper.mjs --arch arm64
The target architecture is resolved from `--arch` (or the `OPENSCREEN_WIN_HELPER_ARCH` env var), falling back to the host arch. Cross-compiling requires the matching MSVC component — "VS C++ ARM64/ARM64EC build tools" for `arm64`. The build writes the CMake output to `electron/native/wgc-capture/build/wgc-capture.exe` and copies the redistributable binary to `electron/native/bin/win32-<arch>/wgc-capture.exe` (e.g. `win32-arm64`).
+Cross-compiling covers this helper, not the installer. `npm run build:win:arm64` has to run on an ARM64 host: `fetch-ffmpeg.mjs` and `fetch-onnxruntime.mjs` provision for the host, and the ffmpeg licence check runs the downloaded binary. CI therefore builds the arm64 installer on a `windows-11-arm` runner.
+
The helper contract is process-based: the app starts the process with one JSON argument and sends commands on stdin. `stop\n` finalizes the recording. During migration the helper prints both newline-delimited JSON events and the legacy text messages `Recording started` / `Recording stopped. Output path: <path>`.
Current V2 JSON shape:
diff --git a/scripts/mac-update-feed.mjs b/scripts/mac-update-feed.mjs
index 042160b14..40de3477c 100644
--- a/scripts/mac-update-feed.mjs
+++ b/scripts/mac-update-feed.mjs
@@ -8,6 +8,11 @@
// architecture served the wrong build — electron-builder#5592, closed as not-planned. So each
// job emits a JSON sidecar and `merge` folds both into ONE feed with two `files:` entries.
//
+// Windows has the same shape — x64 on windows-latest, arm64 on windows-11-arm — and reuses
+// both subcommands for its NSIS `latest.yml`. Nothing below is macOS-specific: NsisUpdater's
+// `findFile` also picks the entry whose name contains `process.arch`, and the x64 fallback
+// is as right for Windows on ARM, which emulates x64, as it is for Rosetta.
+//
// describe <zip> <version> <out.json> — per-arch, on the macOS runner
// merge <a.json> <b.json> <out.yml> — once, on the publish runner
//
diff --git a/scripts/mac-update-feed.test.mjs b/scripts/mac-update-feed.test.mjs
index 36c761586..89fc887b1 100644
--- a/scripts/mac-update-feed.test.mjs
+++ b/scripts/mac-update-feed.test.mjs
@@ -60,4 +60,18 @@ describe("buildFeedYml", () => {
it("refuses to mix versions, which is what a stale artifact looks like", () => {
expect(() => buildFeedYml([ARM, { ...X64, version: "1.9.2" }], NOW)).toThrow(/disagree/);
});
+
+ // build.yml folds the two Windows NSIS installers through the same merge.
+ it("builds the Windows feed from the arch-tagged installer names", () => {
+ const yml = buildFeedYml(
+ [
+ { ...ARM, url: "Openscreen.Setup.1.9.3-arm64.exe" },
+ { ...X64, url: "Openscreen.Setup.1.9.3-x64.exe" },
+ ],
+ NOW,
+ );
+ expect(yml).toContain(" - url: Openscreen.Setup.1.9.3-arm64.exe");
+ expect(yml).toContain(" - url: Openscreen.Setup.1.9.3-x64.exe");
+ expect(yml).toMatch(/^path: Openscreen\.Setup\.1\.9\.3-x64\.exe$/m);
+ });
});