From 0bd338a94cd9820e70284c535df6268028b0035f Mon Sep 17 00:00:00 2001 From: baiqing Date: Mon, 4 May 2026 23:11:41 +0800 Subject: [PATCH] ci(release): split Windows tauri build into NSIS + MSI passes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Tauri 的签名 / updater artifact 是 post-bundle 钩子,单次 tauri build 内 任意 bundler 失败都会跳过 .sig 生成。MSI 必踩 ICE80,所以单 pass 永远 拿不到 NSIS 的 .exe.sig(v1.2.18 build 验证)。 拆两轮: - Pass 1: --bundles nsis 单独跑,必须成功,产出 .exe + .exe.sig - Pass 2: --bundles msi 单独跑,允许 ICE80 失败,Repair 用 light 重链兜底 不 bump 版本号——下一次 release 之前用 workflow_dispatch 验证 CI 全绿。 --- .github/workflows/release-tauri.yml | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/.github/workflows/release-tauri.yml b/.github/workflows/release-tauri.yml index f7668950..4f87aaea 100644 --- a/.github/workflows/release-tauri.yml +++ b/.github/workflows/release-tauri.yml @@ -226,16 +226,29 @@ jobs: TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }} run: | set +e - # 顺序很关键:NSIS 必须先跑、产出 *_x64-setup.exe(.sig) 给 updater 用。 - # Tauri 的 "all" 默认按字母序 msi→nsis,MSI 一旦 ICE80 挂掉就 short-circuit - # 整个 bundle 流程,NSIS 完全没机会执行。显式 --bundles nsis,msi 强制顺序。 + # 拆两轮跑:Tauri 的签名 / updater artifact 阶段是 post-bundle 钩子, + # 任意 bundler 失败会让 *所有* bundle 的 .sig 跳过。MSI 必踩 ICE80, + # 所以单一 `tauri build` 永远拿不到 NSIS 的 .exe.sig。 + # Pass 1:NSIS 独立跑——必须成功,产出 *_x64-setup.exe(.sig) 给 updater。 + # Pass 2:MSI 独立跑——允许失败,Repair 步骤兜底 light.exe 重链。 if [ -n "${TAURI_SIGNING_PRIVATE_KEY:-}" ]; then - npm run tauri -- build --bundles nsis,msi --config '{"bundle":{"createUpdaterArtifacts":true}}' + npm run tauri -- build --bundles nsis --config '{"bundle":{"createUpdaterArtifacts":true}}' + nsis_exit=$? + npm run tauri -- build --bundles msi --config '{"bundle":{"createUpdaterArtifacts":true}}' + msi_exit=$? else - npm run tauri -- build --bundles nsis,msi + npm run tauri -- build --bundles nsis + nsis_exit=$? + npm run tauri -- build --bundles msi + msi_exit=$? fi - echo "TAURI_BUILD_EXIT=$?" >> "$GITHUB_ENV" - # 不直接退出失败:下一步 Repair 还有兜底机会(NSIS 已先于 MSI 写盘)。 + echo "TAURI_BUILD_EXIT=$msi_exit" >> "$GITHUB_ENV" + # NSIS 是 updater 的硬依赖,挂了就直接 fail step。 + if [ "$nsis_exit" -ne 0 ]; then + echo "::error::NSIS bundle failed (exit $nsis_exit) — updater artifact unavailable." + exit 1 + fi + # MSI 失败不挡——下一步 Repair 用 light.exe 重链(带 -sice:ICE80)。 exit 0 # ── 如果 tauri 在 wix link 阶段失败(candle 出了 wixobj,但 light 因 cwd