fix: prevent x64 native module rebuild on ARM64 CI runner

On ubuntu-24.04-arm runners, electron-builder's post-build
@electron/rebuild incorrectly tries to restore native modules
to x64 architecture. The ARM64 g++ compiler doesn't support the
-m64 flag, causing the build to fail.

Setting npm_config_arch=arm64 ensures node-gyp correctly identifies
the host architecture, preventing the erroneous x64 rebuild.
This commit is contained in:
bincxz
2026-03-03 20:54:28 +08:00
parent 2d34e162c0
commit f42cd8cdd1
+4
View File
@@ -66,6 +66,10 @@ jobs:
env:
CSC_IDENTITY_AUTO_DISCOVERY: ${{ matrix.name == 'macos' && 'false' || '' }}
ELECTRON_BUILDER_PUBLISH: "never"
# On ARM64 runners, electron-builder's post-build @electron/rebuild incorrectly
# tries to restore native modules to x64, but the ARM g++ doesn't support -m64.
# Setting npm_config_arch ensures node-gyp uses the correct host architecture.
npm_config_arch: ${{ matrix.name == 'linux-arm64' && 'arm64' || '' }}
run: npm run ${{ matrix.pack_script }}
- name: Upload artifacts