diff --git a/scripts/notarize_submit.sh b/scripts/notarize_submit.sh index 65826d172d..7c2e1aaad3 100755 --- a/scripts/notarize_submit.sh +++ b/scripts/notarize_submit.sh @@ -32,23 +32,33 @@ echo "=== Creating ZIP for notarization: $ZIP_PATH ===" >&2 ditto -c -k --keepParent "$APP_PATH" "$ZIP_PATH" echo "=== Submitting to Apple for notarization ===" >&2 +set +e SUBMIT_OUTPUT=$(xcrun notarytool submit "$ZIP_PATH" \ --apple-id "$APPLE_ID" \ --password "$APP_SPECIFIC_PASSWORD" \ --team-id "$TEAM_ID" 2>&1) +SUBMIT_STATUS=$? +set -e echo "$SUBMIT_OUTPUT" >&2 +if [ "$SUBMIT_STATUS" -ne 0 ]; then + rm -f "$ZIP_PATH" + echo "ERROR: notarytool submit failed with exit code $SUBMIT_STATUS" >&2 + exit "$SUBMIT_STATUS" +fi + # Extract submission ID -SUBMISSION_ID=$(echo "$SUBMIT_OUTPUT" | grep "id:" | head -1 | awk '{print $2}') +SUBMISSION_ID=$(echo "$SUBMIT_OUTPUT" | awk '/^[[:space:]]*id:/ {print $2; exit}') if [ -z "$SUBMISSION_ID" ]; then + rm -f "$ZIP_PATH" echo "ERROR: Failed to get submission ID" >&2 exit 1 fi # Clean up the zip -rm "$ZIP_PATH" +rm -f "$ZIP_PATH" echo "Submission ID: $SUBMISSION_ID" >&2