Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 20 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"
Comment on lines 275 to +276

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bug · high
notarytool 通过管道传给 tee 后,步骤的退出码取决于管道最后一个命令(tee),而该 run 块没有 set -o pipefail,因此 notarytool 提交失败(非 Invalid 而是错误退出)时会被 tee 的成功退出码掩盖,后续 Invalid 检查会基于不完整日志运行。建议在脚本开头加 set -euo pipefail。

Suggestion:

Suggested change
--wait \
--timeout 30m
--timeout 30m 2>&1 | tee "$SUBMIT_LOG"
set -euo pipefail
xcrun notarytool submit "$ZIP_PATH" \
--apple-id "$APPLE_ID" \
--password "$APPLE_APP_SPECIFIC_PASSWORD" \
--team-id "$APPLE_TEAM_ID" \
--wait \
--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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bug · medium
该检查只覆盖 "status: Invalid";notarytool 也可能输出 "status: Rejected" 或 "status: In Progress"/超时等其他终态。建议改为排除 Accepted 的否定判断(如 ! grep -q "status: Accepted" "$SUBMIT_LOG"),避免 Rejected 提交被误当作成功并进入 stapler 步骤。

Suggestion:

Suggested change
if grep -q "status: Invalid" "$SUBMIT_LOG"; then
if ! grep -q "status: Accepted" "$SUBMIT_LOG"; then

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"
Expand Down
2 changes: 1 addition & 1 deletion TransFrame.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "set -euo pipefail\n# Thin and sign embedded frameworks\nFRAMEWORKS_DIR=\"${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.app/Contents/Frameworks\"\nif [ -d \"$FRAMEWORKS_DIR\" ]; then\n TARGET_ARCH=\"${ARCHS:-arm64}\"\n if [ \"$TARGET_ARCH\" = \"arm64\" ] || [ \"$TARGET_ARCH\" = \"x86_64\" ]; then\n if [ -d \"$FRAMEWORKS_DIR/Sparkle.framework\" ]; then\n SPARKLE=\"$FRAMEWORKS_DIR/Sparkle.framework\"\n for b in \"Versions/B/Sparkle\" \"Versions/B/Autoupdate\" \"Versions/B/Updater.app/Contents/MacOS/Updater\" \"Versions/B/XPCServices/Downloader.xpc/Contents/MacOS/Downloader\" \"Versions/B/XPCServices/Installer.xpc/Contents/MacOS/Installer\"; do\n if [ -f \"$SPARKLE/$b\" ]; then\n lipo -thin \"$TARGET_ARCH\" \"$SPARKLE/$b\" -output \"$SPARKLE/$b.thin\" 2>/dev/null && mv \"$SPARKLE/$b.thin\" \"$SPARKLE/$b\" || true\n strip -x \"$SPARKLE/$b\" 2>/dev/null || true\n fi\n done\n fi\n fi\n SIGN_ID=\"${EXPANDED_CODE_SIGN_IDENTITY:-}\"\n if [ -z \"$SIGN_ID\" ] || [ \"$SIGN_ID\" = \"-\" ]; then\n SIGN_ID=$(security find-identity -v -p codesigning | grep -m1 \"Developer ID Application\" | awk -F '\"' '{print $2}' || true)\n fi\n if [ -z \"$SIGN_ID\" ]; then\n SIGN_ID=\"-\"\n fi\n for FRAMEWORK in \"$FRAMEWORKS_DIR\"/*.framework; do\n if [ -d \"$FRAMEWORK\" ]; then\n echo \"Re-signing framework with $SIGN_ID: $(basename \"$FRAMEWORK\")\"\n codesign --force --sign \"$SIGN_ID\" --timestamp=none --deep \"$FRAMEWORK\"\n fi\n done\nfi\nmkdir -p \"${DERIVED_FILE_DIR}\"\ntouch \"${DERIVED_FILE_DIR}/TransFrameFrameworkResign.stamp\"\n";
shellScript = "set -euo pipefail\n# Thin and sign embedded frameworks\nFRAMEWORKS_DIR=\"${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.app/Contents/Frameworks\"\nif [ -d \"$FRAMEWORKS_DIR\" ]; then\n TARGET_ARCH=\"${ARCHS:-arm64}\"\n if [ \"$TARGET_ARCH\" = \"arm64\" ] || [ \"$TARGET_ARCH\" = \"x86_64\" ]; then\n if [ -d \"$FRAMEWORKS_DIR/Sparkle.framework\" ]; then\n SPARKLE=\"$FRAMEWORKS_DIR/Sparkle.framework\"\n for b in \"Versions/B/Sparkle\" \"Versions/B/Autoupdate\" \"Versions/B/Updater.app/Contents/MacOS/Updater\" \"Versions/B/XPCServices/Downloader.xpc/Contents/MacOS/Downloader\" \"Versions/B/XPCServices/Installer.xpc/Contents/MacOS/Installer\"; do\n if [ -f \"$SPARKLE/$b\" ]; then\n lipo -thin \"$TARGET_ARCH\" \"$SPARKLE/$b\" -output \"$SPARKLE/$b.thin\" 2>/dev/null && mv \"$SPARKLE/$b.thin\" \"$SPARKLE/$b\" || true\n strip -x \"$SPARKLE/$b\" 2>/dev/null || true\n fi\n done\n fi\n fi\n SIGN_ID=\"${EXPANDED_CODE_SIGN_IDENTITY:-}\"\n if [ -z \"$SIGN_ID\" ] || [ \"$SIGN_ID\" = \"-\" ]; then\n SIGN_ID=$(security find-identity -v -p codesigning | grep -m1 \"Developer ID Application\" | awk -F '\"' '{print $2}' || true)\n fi\n if [ -z \"$SIGN_ID\" ]; then\n SIGN_ID=\"-\"\n fi\n for FRAMEWORK in \"$FRAMEWORKS_DIR\"/*.framework; do\n if [ -d \"$FRAMEWORK\" ]; then\n echo \"Re-signing framework with $SIGN_ID: $(basename \"$FRAMEWORK\")\"\n codesign --force --sign \"$SIGN_ID\" --timestamp --deep \"$FRAMEWORK\"\n fi\n done\nfi\nmkdir -p \"${DERIVED_FILE_DIR}\"\ntouch \"${DERIVED_FILE_DIR}/TransFrameFrameworkResign.stamp\"\n";
};
/* End PBXShellScriptBuildPhase section */

Expand Down
Loading