@@ -54,6 +54,26 @@ if gh release view "$TAG" --repo "$PUBLIC_REPO" >/dev/null 2>&1; then
5454 exit 1
5555fi
5656
57+ # Reclaim disk: old DMGs from prior builds are already published — drop them so
58+ # the target dir doesn't fill up (hdiutil fails with "No space left on device").
59+ rm -f " $BUNDLE " /dmg/MyDevTools_* _universal.dmg " $BUNDLE " /dmg/MyDevTools.dmg 2> /dev/null || true
60+ # Single staging workdir, cleaned on ANY exit (so a mid-run failure doesn't leak
61+ # ~90MB of copied .app each time).
62+ WORK=" $( mktemp -d) "
63+ trap ' rm -rf "$WORK"' EXIT
64+
65+ # Sign a file with a Developer ID + secure timestamp, retrying transient
66+ # timestamp.apple.com failures ("A timestamp was expected but was not found").
67+ codesign_retry () {
68+ local target=" $1 " i
69+ for i in 1 2 3 4 5; do
70+ if codesign --force --timestamp --sign " $APPLE_SIGNING_IDENTITY " " $target " 2> /tmp/cs_err; then return 0; fi
71+ echo " codesign attempt $i failed: $( cat /tmp/cs_err) — retrying in 10s…" >&2
72+ sleep 10
73+ done
74+ echo " release-local: codesign failed after 5 attempts" >&2 ; return 1
75+ }
76+
5777# ── 1. build: Apple-sign the app AND sign the updater payload ─────────────────
5878# createUpdaterArtifacts:true makes tauri build emit + sign the .app.tar.gz, so
5979# TAURI_SIGNING_PRIVATE_KEY must be set here. Letting Tauri produce the tarball
@@ -72,7 +92,7 @@ TARBALL_NAME="$(basename "$TARGZ")"
7292
7393# ── 2. notarize + staple the .app (for the DMG download path) ─────────────────
7494echo " ▸ [2/5] Notarizing & stapling the app…"
75- APP_ZIP=" $( mktemp -d ) /app.zip"
95+ APP_ZIP=" $WORK /app.zip"
7696ditto -c -k --keepParent " $APP " " $APP_ZIP "
7797xcrun notarytool submit " $APP_ZIP " --keychain-profile " $NOTARY_PROFILE " --wait
7898xcrun stapler staple " $APP "
@@ -81,13 +101,14 @@ rm -f "$APP_ZIP"
81101# ── 3. DMG for fresh downloads: hdiutil (deterministic), sign, notarize, staple ─
82102echo " ▸ [3/5] Building, signing & notarizing the DMG…"
83103mkdir -p " $BUNDLE /dmg"
84- STAGE=" $( mktemp -d) "
104+ STAGE=" $WORK /stage"
105+ mkdir -p " $STAGE "
85106cp -R " $APP " " $STAGE /"
86107ln -s /Applications " $STAGE /Applications"
87108rm -f " $DMG "
88109hdiutil create -volname " MyDevTools" -srcfolder " $STAGE " -ov -format UDZO " $DMG " > /dev/null
89110rm -rf " $STAGE "
90- codesign --force --sign " $APPLE_SIGNING_IDENTITY " " $DMG "
111+ codesign_retry " $DMG "
91112xcrun notarytool submit " $DMG " --keychain-profile " $NOTARY_PROFILE " --wait
92113xcrun stapler staple " $DMG "
93114
0 commit comments