Repository navigation
ci(release): use secure timestamps and surface notarization rejections #84
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 | ||||
|---|---|---|---|---|---|---|
|
|
@@ -205,7 +205,9 @@ jobs: | |||||
|
|
||||||
| if [ -n "$SIGN_IDENTITY" ]; then | ||||||
| echo "Signing application bundle with: $SIGN_IDENTITY" | ||||||
| codesign --force --deep --options runtime --timestamp=none \ | ||||||
| # --timestamp adds the RFC 3161 secure timestamp Apple notarization | ||||||
| # requires; --timestamp=none made the submission Invalid (1.0.2/1.0.3). | ||||||
| codesign --force --deep --options runtime --timestamp \ | ||||||
| --sign "$SIGN_IDENTITY" \ | ||||||
| build/Build/Products/Release/${{ env.PROJECT_NAME }}.app | ||||||
| else | ||||||
|
|
@@ -265,12 +267,28 @@ jobs: | |||||
| ditto -c -k --keepParent "$APP_PATH" "$ZIP_PATH" | ||||||
|
|
||||||
| echo "Submitting to Apple notarization service..." | ||||||
| SUBMIT_LOG="$RUNNER_TEMP/notary-submit.log" | ||||||
| xcrun notarytool submit "$ZIP_PATH" \ | ||||||
| --apple-id "$APPLE_ID" \ | ||||||
| --password "$APPLE_APP_SPECIFIC_PASSWORD" \ | ||||||
| --team-id "$APPLE_TEAM_ID" \ | ||||||
| --wait \ | ||||||
| --timeout 30m | ||||||
| --timeout 30m 2>&1 | tee "$SUBMIT_LOG" | ||||||
|
|
||||||
| # notarytool exits 0 even for status: Invalid — surface the rejection | ||||||
| # and Apple's issue list instead of failing later at stapler with 65. | ||||||
| if grep -q "status: Invalid" "$SUBMIT_LOG"; then | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggestion:
Suggested change
|
||||||
| SUBMIT_ID=$(grep -oE 'id: [0-9a-f-]{36}' "$SUBMIT_LOG" | head -1 | awk '{print $2}') | ||||||
| echo "Notarization Invalid. Fetching Apple's issues for submission ${SUBMIT_ID:-<unknown>}..." | ||||||
| if [ -n "$SUBMIT_ID" ]; then | ||||||
| xcrun notarytool log "$SUBMIT_ID" \ | ||||||
| --apple-id "$APPLE_ID" \ | ||||||
| --password "$APPLE_APP_SPECIFIC_PASSWORD" \ | ||||||
| --team-id "$APPLE_TEAM_ID" || true | ||||||
| fi | ||||||
| echo "##[error]Apple notarization rejected the submission" | ||||||
| exit 1 | ||||||
| fi | ||||||
|
|
||||||
| echo "Stapling notarization ticket to app..." | ||||||
| xcrun stapler staple "$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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
notarytool 通过管道传给 tee 后,步骤的退出码取决于管道最后一个命令(tee),而该 run 块没有
set -o pipefail,因此 notarytool 提交失败(非 Invalid 而是错误退出)时会被 tee 的成功退出码掩盖,后续 Invalid 检查会基于不完整日志运行。建议在脚本开头加set -euo pipefail。Suggestion: