Skip to content

Commit 3609c1b

Browse files
committed
Fix code signing: use proper codesign flags and ditto for zip
Based on https://haim.dev/posts/2020-08-08-python-macos-app/: - Re-sign with -s, --deep, --timestamp, --entitlements, -o runtime - Use ditto instead of zip for distribution to preserve signatures The previous build passed notarization but the app failed to run because the distribution zip was created with 'zip -r' which can corrupt extended attributes and code signatures.
1 parent 128f5ef commit 3609c1b

1 file changed

Lines changed: 10 additions & 7 deletions

File tree

.github/workflows/build-release.yml

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -147,9 +147,10 @@ jobs:
147147
--add-data "models:models" \
148148
main.py
149149
150-
- name: Verify and re-sign app bundle
151-
# PyInstaller already signed the embedded binaries, but we re-sign the outer
152-
# bundle with a timestamp for notarization and verify everything
150+
- name: Re-sign app bundle with timestamp
151+
# PyInstaller signs but without timestamp. We must re-sign with
152+
# --deep --timestamp for notarization. Based on:
153+
# https://haim.dev/posts/2020-08-08-python-macos-app/
153154
run: |
154155
APP_PATH="dist/RunnerBibTagger.app"
155156
ENTITLEMENTS="entitlements.plist"
@@ -161,10 +162,11 @@ jobs:
161162
# Remove quarantine attributes
162163
xattr -cr "$APP_PATH"
163164
164-
# Re-sign the main app bundle with timestamp (required for notarization)
165+
# Re-sign with timestamp (required for notarization)
166+
# Using -s instead of --sign, and explicit flags as recommended
165167
echo "=== Re-signing app bundle with timestamp ==="
166-
codesign --force --deep --options runtime --entitlements "$ENTITLEMENTS" \
167-
--sign "$CODESIGN_IDENTITY" --timestamp "$APP_PATH"
168+
codesign -s "$CODESIGN_IDENTITY" -v --deep --timestamp \
169+
--entitlements "$ENTITLEMENTS" -o runtime "$APP_PATH"
168170
169171
# Verify signature
170172
echo "=== Verifying signature ==="
@@ -193,9 +195,10 @@ jobs:
193195
rm "dist/RunnerBibTagger-notarize.zip"
194196
195197
- name: Create distribution ZIP
198+
# Use ditto instead of zip to preserve code signatures and extended attributes
196199
run: |
197200
cd dist
198-
zip -r RunnerBibTagger-macOS.zip RunnerBibTagger.app
201+
ditto -c -k --keepParent RunnerBibTagger.app RunnerBibTagger-macOS.zip
199202
200203
- name: Upload artifact
201204
uses: actions/upload-artifact@v4

0 commit comments

Comments
 (0)