fix(release): notarize and staple the DMGs, not just the .app (#34)
tauri-action notarizes and staples the .app but never the .dmg wrapping it, so
Gatekeeper rejected the downloaded DMG as "Unnotarized Developer ID" even
though the app inside was fine:
spctl --assess --type open --context context:primary-signature -v \
Gridline_0.8.0_aarch64.dmg
-> rejected, source=Unnotarized Developer ID
Gatekeeper assesses the DMG itself when a user opens the download, so the app
being notarized does not save the mount. Submit each DMG to the same notary
service and staple the ticket into it.
- release.yml: new macOS-only step after tauri-action replaces each uploaded
DMG with its stapled copy. Assets are replaced via the release ID because the
GitHub releases/tags endpoint 404s for drafts, so uploading by tag cannot
work while the release is still a draft.
- release-mac.sh: same notarize + staple pass for the local/Gitea path before
upload, respecting GRIDLINE_SKIP_NOTARIZE.
- README: state that both the .app and the .dmg carry a stapled ticket.
This commit is contained in:
@@ -439,6 +439,59 @@ jobs:
|
||||
# README download tables link to them statically per release —
|
||||
# remember to update both README tables when cutting a new version.
|
||||
|
||||
# tauri-action notarizes + staples the .app but NOT the .dmg wrapping it,
|
||||
# so Gatekeeper rejects the downloaded DMG as "Unnotarized Developer ID"
|
||||
# even though the app inside is fine. Submit the DMG to the same notary
|
||||
# service, staple the ticket, and replace the uploaded asset.
|
||||
#
|
||||
# Assets are replaced via the release ID rather than `gh release upload`:
|
||||
# the GitHub releases/tags endpoint returns 404 for drafts, so uploading
|
||||
# by tag cannot work while the release is still a draft.
|
||||
- name: Notarize and staple the DMGs
|
||||
if: startsWith(matrix.platform, 'macos') && steps.apple.outputs.enabled == 'true'
|
||||
shell: bash
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
shopt -s nullglob
|
||||
dmgs=(desktop/src-tauri/target/*/release/bundle/dmg/*.dmg)
|
||||
if [ ${#dmgs[@]} -eq 0 ]; then
|
||||
echo "no DMG produced" >&2
|
||||
exit 1
|
||||
fi
|
||||
REL_ID=$(gh api "repos/${GITHUB_REPOSITORY}/releases?per_page=100" \
|
||||
--jq ".[] | select(.tag_name == \"${RELEASE_TAG}\") | .id" | head -1)
|
||||
if [ -z "$REL_ID" ]; then
|
||||
echo "could not resolve a release id for ${RELEASE_TAG}" >&2
|
||||
exit 1
|
||||
fi
|
||||
for dmg in "${dmgs[@]}"; do
|
||||
name=$(basename "$dmg")
|
||||
echo ">> notarizing $name (this can take a few minutes)"
|
||||
xcrun notarytool submit "$dmg" \
|
||||
--key "$APPLE_API_KEY_PATH" \
|
||||
--key-id "$APPLE_API_KEY" \
|
||||
--issuer "$APPLE_API_ISSUER" \
|
||||
--wait
|
||||
xcrun stapler staple "$dmg"
|
||||
xcrun stapler validate "$dmg"
|
||||
# Replace the copy tauri-action uploaded, which carries no DMG ticket.
|
||||
old=$(gh api "repos/${GITHUB_REPOSITORY}/releases/${REL_ID}/assets" \
|
||||
--jq ".[] | select(.name == \"${name}\") | .id" | head -1)
|
||||
if [ -n "$old" ]; then
|
||||
gh api -X DELETE "repos/${GITHUB_REPOSITORY}/releases/assets/${old}"
|
||||
fi
|
||||
echo ">> re-uploading stapled $name"
|
||||
curl -fsS -X POST \
|
||||
-H "Authorization: token ${GH_TOKEN}" \
|
||||
-H "Content-Type: application/octet-stream" \
|
||||
--data-binary "@${dmg}" \
|
||||
"https://uploads.github.com/repos/${GITHUB_REPOSITORY}/releases/${REL_ID}/assets?name=${name}"
|
||||
echo
|
||||
done
|
||||
echo "all DMGs notarized and stapled"
|
||||
|
||||
# After the installers are uploaded, refresh the Homebrew cask in the
|
||||
# AdrianBonpin/homebrew-gridline tap: hash the freshly-published DMGs,
|
||||
# render Casks/gridline.rb from the template, and push it. Users then get
|
||||
|
||||
Reference in New Issue
Block a user