@@ -11,7 +11,7 @@ permissions:
1111jobs :
1212 build-notarize-release :
1313 runs-on : macos-14
14- timeout-minutes : 120
14+ timeout-minutes : 360
1515 steps :
1616 - name : Checkout
1717 uses : actions/checkout@v4
@@ -66,19 +66,72 @@ jobs:
6666 echo "${{ secrets.APPLE_NOTARYTOOL_API_KEY_P8_BASE64 }}" | base64 -D > AuthKey.p8 2>/dev/null || \
6767 echo "${{ secrets.APPLE_NOTARYTOOL_API_KEY_P8_BASE64 }}" | base64 -d > AuthKey.p8
6868
69- - name : Notarize DMG
69+ - name : Notarize DMG (poll until accepted)
7070 shell : bash
7171 run : |
7272 set -euo pipefail
73- xcrun notarytool store-credentials "time-tracker-notary" \
73+ KEY_ID="${{ secrets.APPLE_NOTARYTOOL_KEY_ID }}"
74+ ISSUER_ID="${{ secrets.APPLE_NOTARYTOOL_ISSUER_ID }}"
75+ DMG="${{ steps.paths.outputs.dmg }}"
76+
77+ echo "Submitting: $DMG"
78+ SUBMIT_JSON="$(xcrun notarytool submit "$DMG" \
7479 --key AuthKey.p8 \
75- --key-id "${{ secrets.APPLE_NOTARYTOOL_KEY_ID }}" \
76- --issuer "${{ secrets.APPLE_NOTARYTOOL_ISSUER_ID }}"
80+ --key-id "$KEY_ID" \
81+ --issuer "$ISSUER_ID" \
82+ --output-format json)"
83+
84+ SUBMISSION_ID="$(python3 -c 'import json,sys; print(json.load(sys.stdin)["id"])' <<<"$SUBMIT_JSON")"
85+
86+ echo "submission_id=$SUBMISSION_ID" >> "$GITHUB_OUTPUT"
87+ echo "Submission ID: $SUBMISSION_ID"
88+
89+ start_ts="$(date +%s)"
90+ deadline_seconds="$((5 * 60 * 60))"
91+
92+ while true; do
93+ now_ts="$(date +%s)"
94+ elapsed="$((now_ts - start_ts))"
95+ if [ "$elapsed" -ge "$deadline_seconds" ]; then
96+ echo "Timed out waiting for notarization after $elapsed seconds."
97+ echo "You can check status later with:"
98+ echo " xcrun notarytool info $SUBMISSION_ID --key AuthKey.p8 --key-id $KEY_ID --issuer $ISSUER_ID"
99+ exit 1
100+ fi
101+
102+ INFO_JSON="$(xcrun notarytool info "$SUBMISSION_ID" \
103+ --key AuthKey.p8 \
104+ --key-id "$KEY_ID" \
105+ --issuer "$ISSUER_ID" \
106+ --output-format json 2>/dev/null || true)"
107+
108+ if [ -z "$INFO_JSON" ]; then
109+ echo "Notary status check failed (temporary); retrying in 30s..."
110+ sleep 30
111+ continue
112+ fi
113+
114+ STATUS="$(python3 -c 'import json,sys; print(json.load(sys.stdin).get("status",""))' <<<"$INFO_JSON")"
77115
78- xcrun notarytool submit "${{ steps.paths.outputs.dmg }}" \
79- --keychain-profile "time-tracker-notary" \
80- --wait \
81- --timeout 110m
116+ case "$STATUS" in
117+ Accepted)
118+ echo "Notarization Accepted."
119+ break
120+ ;;
121+ Invalid)
122+ echo "Notarization Invalid. Fetching log..."
123+ xcrun notarytool log "$SUBMISSION_ID" \
124+ --key AuthKey.p8 \
125+ --key-id "$KEY_ID" \
126+ --issuer "$ISSUER_ID"
127+ exit 1
128+ ;;
129+ *)
130+ echo "Current status: ${STATUS:-In Progress}..."
131+ sleep 30
132+ ;;
133+ esac
134+ done
82135
83136 - name : Staple and validate
84137 run : |
0 commit comments