-
Notifications
You must be signed in to change notification settings - Fork 293
#1922 Implement macOS codesign & notarization #1927
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,109 @@ | ||
| name: 'Notarize macOS App' | ||
| description: 'Complete macOS app code signing and notarization with certificate setup' | ||
| inputs: | ||
| app_path: | ||
| description: 'The app bundle zip file path' | ||
| required: true | ||
| p12_base64: | ||
| description: 'Base64 encoded P12 certificate file' | ||
| required: true | ||
| p12_password: | ||
| description: 'Password for the P12 certificate' | ||
| required: true | ||
| apple_id: | ||
| description: 'Apple ID for notarization' | ||
| required: true | ||
| apple_id_password: | ||
| description: 'App-specific password for Apple ID' | ||
| required: true | ||
| team_id: | ||
| description: 'Apple Developer Team ID' | ||
| required: true | ||
| certificate_identity: | ||
| description: 'Code signing certificate identity' | ||
| required: true | ||
|
|
||
| runs: | ||
| using: 'composite' | ||
| steps: | ||
| - name: Check Prerequisites | ||
| shell: bash | ||
| run: | | ||
| echo "Checking if Apple Developer credentials are available..." | ||
|
|
||
| if [ -z "${{ inputs.apple_id }}" ]; then | ||
| echo "No Apple ID provided - skipping code signing and notarization." | ||
| echo "The app build will continue without notarization." | ||
| echo "SKIP_NOTARIZATION=true" >> $GITHUB_ENV | ||
| else | ||
| echo "Apple ID found - proceeding with code signing and notarization." | ||
| echo "SKIP_NOTARIZATION=false" >> $GITHUB_ENV | ||
| fi | ||
|
|
||
| - name: Setup Code Signing Certificate | ||
| if: env.SKIP_NOTARIZATION != 'true' | ||
| shell: bash | ||
| run: | | ||
| echo "Create temporary keychain" | ||
| security create-keychain -p temp_password build.keychain | ||
| security default-keychain -s build.keychain | ||
| security unlock-keychain -p temp_password build.keychain | ||
|
|
||
| echo "Import certificate" | ||
| echo "${{ inputs.p12_base64 }}" | base64 --decode > certificate.p12 | ||
| security import certificate.p12 -k build.keychain -P "${{ inputs.p12_password }}" -A | ||
| rm certificate.p12 | ||
|
|
||
| echo "Set keychain settings" | ||
| security set-key-partition-list -S apple-tool:,apple: -s -k temp_password build.keychain | ||
|
|
||
| echo "Available signing identities:" | ||
| security find-identity -v -p codesigning build.keychain | ||
|
|
||
| - name: Code Sign App | ||
| if: env.SKIP_NOTARIZATION != 'true' | ||
| shell: bash | ||
| run: | | ||
| echo "Extracting and debugging app bundle..." | ||
| ditto -x -k ${{ inputs.app_path }} ./app_notarization | ||
|
|
||
| echo "Code signing app..." | ||
| codesign --force --deep --options runtime --sign "${{ inputs.certificate_identity }}" "./app_notarization/Pencil2D.app" | ||
|
|
||
| echo "Verifying code signature" | ||
| codesign --verify --verbose=4 "./app_notarization/Pencil2D.app" | ||
| echo "Code signature verification successful!" | ||
|
|
||
| ditto -c -k --rsrc --keepParent "./app_notarization/Pencil2D.app" "./app_notarization.zip" | ||
|
|
||
| - name: Submit for Notarization | ||
| if: env.SKIP_NOTARIZATION != 'true' | ||
| shell: bash | ||
| run: | | ||
| echo "Submitting to Apple for notarization..." | ||
| xcrun notarytool submit "./app_notarization.zip" \ | ||
| --apple-id "${{ inputs.apple_id }}" \ | ||
| --password "${{ inputs.apple_id_password }}" \ | ||
| --team-id "${{ inputs.team_id }}" \ | ||
| --wait \ | ||
| --timeout 15m | ||
|
|
||
| - name: Staple & Verify Notarization | ||
| if: env.SKIP_NOTARIZATION != 'true' | ||
| shell: bash | ||
| run: | | ||
| echo "Stapling notarization ticket to app..." | ||
| xcrun stapler staple "./app_notarization/Pencil2D.app" | ||
|
|
||
| echo "Verifying notarization..." | ||
| spctl -a -v "./app_notarization/Pencil2D.app" | ||
| echo "App is properly notarized and ready for distribution!" | ||
|
|
||
| - name: Finalize | ||
| if: env.SKIP_NOTARIZATION != 'true' | ||
| shell: bash | ||
| run: | | ||
| echo "Replacing the original app bundle with notarized app bundle" | ||
| rm -rf "${{ inputs.app_path }}" | ||
| ditto -c -k --rsrc --keepParent "./app_notarization/Pencil2D.app" "${{ inputs.app_path }}" | ||
| echo "Notarized app bundle is now at ${{ inputs.app_path }}" | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.