Skip to content

Commit abb752d

Browse files
authored
fix(release): notarize and staple macOS DMGs (#523)
* fix(release): notarize and staple macOS DMGs Tauri's bundler signs the .app and notarizes it, but ships the .dmg wrapper unnotarized. Gatekeeper rejects that on macOS 15 Sequoia (caught by Homebrew Cask CI) and causes the 'app isn't signed' dialog on older Intel Macs when Apple's notarization servers are slow (issue #509). New step submits each built DMG to notarytool, staples the ticket, verifies with spctl, then overwrites the release asset tauri-action already uploaded to the draft release. Adds ~5-10 min per macOS job (notarytool round-trip). * fix(release): fail loudly when no DMG is found to notarize Empty glob + nullglob was silently skipping the loop body, so if Tauri's bundler output path changed we'd re-publish the unnotarized DMGs with a green CI. Assert the glob matched at least one file. * fix(release): resolve release tag from tauri.conf.json, not GITHUB_REF_NAME GITHUB_REF_NAME is the branch name when the workflow runs via workflow_dispatch, so the gh release upload targeted the wrong thing on manual runs. tauri-action derives its tag from tauri.conf.json's version field via the v__VERSION__ template; use the same source so the two always agree.
1 parent f0924d1 commit abb752d

1 file changed

Lines changed: 40 additions & 0 deletions

File tree

‎.github/workflows/release.yml‎

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,46 @@ jobs:
226226
args: ${{ matrix.args }}
227227
includeUpdaterJson: true
228228

229+
# Tauri's bundler signs the .app and notarizes it, but the .dmg wrapper
230+
# ships unnotarized. Gatekeeper rejects that on macOS 15 Sequoia (caught
231+
# by Homebrew Cask CI) and causes "app isn't signed" dialogs on older
232+
# Intel Macs when Apple's notarization servers are slow (see issue #509).
233+
# Submit the .dmg to notarytool, staple the ticket, and overwrite the
234+
# release asset uploaded by tauri-action.
235+
- name: Notarize and staple DMG (macOS)
236+
if: matrix.platform == 'macos-latest' || matrix.platform == 'macos-15-intel'
237+
env:
238+
APPLE_API_KEY_ID: ${{ secrets.APPLE_API_KEY }}
239+
APPLE_API_ISSUER: ${{ secrets.APPLE_API_ISSUER }}
240+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
241+
run: |
242+
set -euo pipefail
243+
KEY_PATH="$HOME/.appstoreconnect/private_keys/AuthKey_${APPLE_API_KEY_ID}.p8"
244+
TARGET=$(echo "${{ matrix.args }}" | sed -n 's/.*--target \([a-z0-9_-]*\).*/\1/p')
245+
DMG_DIR="tauri/src-tauri/target/${TARGET}/release/bundle/dmg"
246+
# Match the release tag tauri-action resolved from tauri.conf.json's
247+
# version field; GITHUB_REF_NAME is a branch name under workflow_dispatch.
248+
RELEASE_TAG="v$(jq -r '.version' tauri/src-tauri/tauri.conf.json)"
249+
shopt -s nullglob
250+
dmgs=("${DMG_DIR}"/*.dmg)
251+
if [ ${#dmgs[@]} -eq 0 ]; then
252+
echo "::error::No DMGs found in ${DMG_DIR} — tauri bundler output path may have changed"
253+
exit 1
254+
fi
255+
for dmg in "${dmgs[@]}"; do
256+
echo "::group::Notarize $(basename "$dmg")"
257+
xcrun notarytool submit "$dmg" \
258+
--key "$KEY_PATH" \
259+
--key-id "$APPLE_API_KEY_ID" \
260+
--issuer "$APPLE_API_ISSUER" \
261+
--wait --timeout 20m
262+
xcrun stapler staple "$dmg"
263+
spctl -a -t open --context context:primary-signature -vv "$dmg"
264+
gh release upload "${RELEASE_TAG}" "$dmg" --clobber \
265+
--repo "${GITHUB_REPOSITORY}"
266+
echo "::endgroup::"
267+
done
268+
229269
build-cuda-windows:
230270
runs-on: windows-latest
231271
permissions:

0 commit comments

Comments
 (0)