From e25b4cd5d49cf61a20182b49531ddedc08879e42 Mon Sep 17 00:00:00 2001 From: Vikram Date: Tue, 1 Dec 2026 08:12:08 +0530 Subject: [PATCH] Release: notarize and staple the Mac .dmg too; quiet a macOS-only warning The 0.12.1 Mac apps are signed, notarized and stapled ("accepted, source=Notarized Developer ID"), but the check failed on the .dmg: Tauri notarizes the app inside it, not the .dmg itself ("rejected, source=Unnotarized Developer ID"). A new step submits the .dmg with notarytool (retrying up to 3 times, since a runner lost its network while waiting for Apple), staples it, and replaces it in the draft release; the check now also validates the .dmg's stapled ticket. `let mut command` in quiet() is only mutated on Windows; allow unused_mut elsewhere so the Mac builds compile without warnings. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/release.yml | 28 ++++++++++++++++++++++++++++ src-tauri/src/lib.rs | 1 + 2 files changed, 29 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 75b63bd..bd83665 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -125,6 +125,33 @@ jobs: includeUpdaterJson: true args: ${{ matrix.args }} + # Tauri notarizes and staples the app inside the .dmg, not the .dmg itself. Notarize and staple the .dmg too + # (retrying, in case the runner's network drops while waiting for Apple), then replace it in the draft release. + - name: Notarize the macOS .dmg + if: matrix.platform == 'macos-latest' + shell: bash + env: + APPLE_API_ISSUER: ${{ secrets.APPLE_API_ISSUER }} + APPLE_API_KEY: ${{ secrets.APPLE_API_KEY }} + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + set -euo pipefail + target=$(echo "${{ matrix.args }}" | sed -E 's/.*--target ([^ ]+).*/\1/') + dmg=$(find "src-tauri/target/$target/release/bundle/dmg" -maxdepth 1 -name '*.dmg' | head -1) + echo "DMG: $dmg" + for attempt in 1 2 3; do + if xcrun notarytool submit "$dmg" --key "$APPLE_API_KEY_PATH" --key-id "$APPLE_API_KEY" --issuer "$APPLE_API_ISSUER" --wait --timeout 60m --output-format json > notary.json; then + cat notary.json + grep -q '"status" *: *"Accepted"' notary.json && break + echo "::error::Apple did not accept the .dmg"; exit 1 + fi + echo "notarytool failed (attempt $attempt); retrying in 30 s"; sleep 30 + [ "$attempt" = 3 ] && exit 1 + done + xcrun stapler staple "$dmg" + version=$(node -p "require('./package.json').version") + gh release upload "v$version" "$dmg" --clobber --repo "$GITHUB_REPOSITORY" + # Fail the release if a Mac build isn't signed with Developer ID, notarized and stapled. - name: Check the macOS signature and notarization if: matrix.platform == 'macos-latest' @@ -141,6 +168,7 @@ jobs: spctl --assess --type execute --verbose=4 "$app" xcrun stapler validate "$app" spctl --assess --type open --context context:primary-signature --verbose=4 "$dmg" + xcrun stapler validate "$dmg" # The VS Code extensions (Veyra Live Server, Veyra Port Manager), attached to the same draft release. vscode-extension: diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index a0d97a5..87b3a72 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -40,6 +40,7 @@ fn plain(path: &Path) -> &Path { dunce::simplified(path) } /// A background command that never opens a console window. Release builds on Windows have no console of their own, /// so without CREATE_NO_WINDOW every git / gh / health-check call flashes a terminal window on screen. pub(crate) fn quiet(program: impl AsRef) -> Command { + #[cfg_attr(not(windows), allow(unused_mut))] // changed only on Windows (no console window) let mut command = Command::new(program); #[cfg(windows)] { use std::os::windows::process::CommandExt; command.creation_flags(0x0800_0000); } command