Skip to content

Commit c2f3998

Browse files
authored
Merge branch 'main' into changeset-release/main
2 parents 2264a8f + 8e261fd commit c2f3998

1 file changed

Lines changed: 29 additions & 3 deletions

File tree

.github/workflows/desktop-release.yml

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,31 @@ jobs:
236236
working-directory: apps/desktop
237237
run: pnpm exec electron-builder --mac dmg zip --publish never
238238
239+
# electron-builder notarizes and staples the .app but never the disk
240+
# image around it. A quarantined, unnotarized DMG is what Gatekeeper
241+
# reports as "damaged" on some macOS builds, so give the image its own
242+
# ticket and staple it. The API key is preferred; the Apple ID +
243+
# app-specific password pair is the fallback, mirroring electron-builder.
244+
- name: Notarize and staple macOS DMG
245+
shell: bash
246+
run: |
247+
set -euo pipefail
248+
dmg_path="$(find apps/desktop/dist -maxdepth 1 -type f -name '*.dmg' -print -quit)"
249+
if [ -z "$dmg_path" ]; then
250+
echo 'macOS DMG not found' >&2
251+
exit 1
252+
fi
253+
if [ -n "${APPLE_API_KEY:-}" ]; then
254+
auth=(--key "$APPLE_API_KEY" --key-id "$APPLE_API_KEY_ID" --issuer "$APPLE_API_ISSUER")
255+
elif [ -n "${APPLE_ID:-}" ]; then
256+
auth=(--apple-id "$APPLE_ID" --password "$APPLE_APP_SPECIFIC_PASSWORD" --team-id "$APPLE_TEAM_ID")
257+
else
258+
echo 'No notarization credentials configured; the DMG cannot be notarized.' >&2
259+
exit 1
260+
fi
261+
xcrun notarytool submit "$dmg_path" "${auth[@]}" --wait --timeout 30m
262+
xcrun stapler staple "$dmg_path"
263+
239264
- name: Verify macOS update artifacts
240265
shell: bash
241266
env:
@@ -293,12 +318,13 @@ jobs:
293318
exit 1
294319
fi
295320
verify_app "$dmg_app"
296-
# electron-builder notarizes and staples the .app, then packs the
297-
# already-stapled bundle into the disk image; the image itself never
298-
# receives a ticket. Validate the staple where it actually lives.
299321
xcrun stapler validate "$dmg_app"
300322
cleanup_mount
301323
trap - EXIT
324+
# The image carries its own ticket (see the notarize step above);
325+
# Gatekeeper must accept it exactly as a user's browser download.
326+
xcrun stapler validate "$dmg_path"
327+
spctl --assess --type open --context context:primary-signature --verbose=2 "$dmg_path"
302328
303329
- name: Mint releases-repo token
304330
if: needs.prepare.outputs.publish == 'true'

0 commit comments

Comments
 (0)