Skip to content

Commit a13aaf4

Browse files
CI macOS: print notary log and submission info on notarization failure
1 parent fc58b0c commit a13aaf4

File tree

1 file changed

+33
-2
lines changed

1 file changed

+33
-2
lines changed

.github/workflows/ci.yml

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,11 +233,42 @@ jobs:
233233
exit 1
234234
fi
235235
236-
xcrun notarytool submit "$DMG_PATH" \
236+
SUBMIT_OUTPUT="$(xcrun notarytool submit "$DMG_PATH" \
237237
--apple-id "$APPLE_ID" \
238238
--password "$APPLE_APP_SPECIFIC_PASSWORD" \
239239
--team-id "$APPLE_TEAM_ID" \
240-
--wait
240+
--output-format json)"
241+
echo "$SUBMIT_OUTPUT"
242+
243+
SUBMISSION_ID="$(echo "$SUBMIT_OUTPUT" | sed -n 's/.*"id"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/p' | head -n1)"
244+
if [ -z "${SUBMISSION_ID:-}" ]; then
245+
echo "Failed to parse notarization submission id"
246+
exit 1
247+
fi
248+
echo "Notary submission id: $SUBMISSION_ID"
249+
250+
set +e
251+
xcrun notarytool wait "$SUBMISSION_ID" \
252+
--apple-id "$APPLE_ID" \
253+
--password "$APPLE_APP_SPECIFIC_PASSWORD" \
254+
--team-id "$APPLE_TEAM_ID" \
255+
--timeout 30m
256+
WAIT_RC=$?
257+
set -e
258+
259+
xcrun notarytool info "$SUBMISSION_ID" \
260+
--apple-id "$APPLE_ID" \
261+
--password "$APPLE_APP_SPECIFIC_PASSWORD" \
262+
--team-id "$APPLE_TEAM_ID" || true
263+
264+
if [ "$WAIT_RC" -ne 0 ]; then
265+
echo "Notarization failed or timed out; printing Apple notary log for diagnostics"
266+
xcrun notarytool log "$SUBMISSION_ID" \
267+
--apple-id "$APPLE_ID" \
268+
--password "$APPLE_APP_SPECIFIC_PASSWORD" \
269+
--team-id "$APPLE_TEAM_ID" || true
270+
exit "$WAIT_RC"
271+
fi
241272
242273
xcrun stapler staple "$DMG_PATH"
243274
xcrun stapler validate "$DMG_PATH"

0 commit comments

Comments
 (0)