fix(build): notarize macOS app bundle before stapling#1245
Conversation
Greptile SummaryThis PR fixes the root cause of the macOS CI failure by correcting the
Confidence Score: 4/5Safe to merge — the core fix is correct and directly unblocks the failing macOS CI jobs; remaining issues are pre-existing or minor style concerns that do not affect the happy path. The single scripts/notarize.sh — the Important Files Changed
Sequence DiagramsequenceDiagram
participant S as notarize.sh
participant D as ditto
participant N as xcrun notarytool
participant St as xcrun stapler
S->>S: test -d dist/ActivityWatch.app
alt .app bundle exists (directory)
S->>D: ditto -c -k --keepParent app app.zip
D-->>S: app.zip created
S->>N: notarytool submit app.zip --wait
N-->>S: notarization ticket issued
S->>St: stapler staple app
St-->>S: ticket stapled to bundle
Note over S: app.zip left behind (not cleaned up)
else .app missing
S->>S: echo Skipping (expected .app bundle directory)
end
S->>S: test -f dist/ActivityWatch.dmg
alt .dmg exists
S->>N: notarytool submit dmg --wait
N-->>S: notarization ticket issued
S->>St: stapler staple dmg
St-->>S: ticket stapled to dmg
else .dmg missing
S->>S: echo Skipping
end
|
| ditto -c -k --keepParent "$app" "$zip" | ||
| $notarization_method "$zip" | ||
| run_stapler "$app" |
There was a problem hiding this comment.
Temporary zip file is never cleaned up
The zip archive created by ditto at $zip (dist/ActivityWatch.app.zip) is used for notarytool submission but is never removed afterwards, leaving a stale artifact alongside the .app bundle and .dmg in dist/. Consider deleting it after stapling:
| ditto -c -k --keepParent "$app" "$zip" | |
| $notarization_method "$zip" | |
| run_stapler "$app" | |
| ditto -c -k --keepParent "$app" "$zip" | |
| $notarization_method "$zip" | |
| run_stapler "$app" | |
| rm -f "$zip" |
|
LGTM. Core fix ( |
Summary
dist/ActivityWatch.appas a bundle directory, not a regular file.appbundle before stapling it, instead of skipping the app notarization step entirelyProblem
build-tauri.ymlwas failing on master in the macOSPackage dmgstep with:Skipping: dist/ActivityWatch.appThe staple and validate action failed! Error 65.The root cause was simple and dumb:
scripts/notarize.shchecked the app bundle withtest -f, but.appis a directory. That made the script skip app notarization entirely, then immediately try to staple an un-notarized app/dmg chain.Validation
bash -n scripts/notarize.shscripts/notarize.shwith fakexcrun/ditto, verifying the.apppath now goes through notarization + stapling instead of the skip branchExpected impact
This should unblock the failing macOS
Build Taurijobs onmaster, which in turn stopsCreate dev releasefrom skipping due to HEAD CI failures.