Skip to content

Commit a36b787

Browse files
committed
ci(desktop): notarize via App Store Connect API key instead of Apple ID
Switch the macOS desktop release notarization path from the Apple ID + app-specific password method to the App Store Connect API key method, which is more robust (no 2FA, no password expiry) and reuses the notary key already provisioned for the org's Apple Developer account. The signing step now reads APPLE_NOTARY_API_KEY_P8_BASE64, APPLE_NOTARY_KEY_ID, and APPLE_NOTARY_ISSUER_ID, decodes the .p8 to a temp file, and exports APPLE_API_KEY/APPLE_API_KEY_ID/APPLE_API_ISSUER, which electron-builder (>=24) consumes to notarize via notarytool. The existing unsigned-draft fallback behavior is preserved.
1 parent e8b4b14 commit a36b787

1 file changed

Lines changed: 14 additions & 4 deletions

File tree

.github/workflows/desktop-release.yml

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -282,8 +282,9 @@ jobs:
282282
shell: bash
283283
env:
284284
IS_DRY_RUN: ${{ inputs.dry_run }}
285-
APPLE_APP_SPECIFIC_PASSWORD_SECRET: ${{ secrets.APPLE_APP_SPECIFIC_PASSWORD }}
286-
APPLE_ID_SECRET: ${{ secrets.APPLE_ID }}
285+
APPLE_NOTARY_API_KEY_P8_BASE64_SECRET: ${{ secrets.APPLE_NOTARY_API_KEY_P8_BASE64 }}
286+
APPLE_NOTARY_KEY_ID_SECRET: ${{ secrets.APPLE_NOTARY_KEY_ID }}
287+
APPLE_NOTARY_ISSUER_ID_SECRET: ${{ secrets.APPLE_NOTARY_ISSUER_ID }}
287288
APPLE_TEAM_ID_SECRET: ${{ secrets.APPLE_TEAM_ID }}
288289
IS_DRAFT: ${{ inputs.draft }}
289290
MAC_CSC_KEY_PASSWORD_SECRET: ${{ secrets.MAC_CSC_KEY_PASSWORD }}
@@ -333,10 +334,19 @@ jobs:
333334
exit 1
334335
fi
335336
337+
# Materialize the App Store Connect API key (.p8) so electron-builder
338+
# (>=24) notarizes via notarytool. It reads APPLE_API_KEY (a path to
339+
# the .p8 file), APPLE_API_KEY_ID, and APPLE_API_ISSUER from the env.
340+
if [ -n "$APPLE_NOTARY_API_KEY_P8_BASE64_SECRET" ] && [ -n "$APPLE_NOTARY_KEY_ID_SECRET" ] && [ -n "$APPLE_NOTARY_ISSUER_ID_SECRET" ]; then
341+
api_key_path="${RUNNER_TEMP}/apple-notary-key.p8"
342+
printf '%s' "$APPLE_NOTARY_API_KEY_P8_BASE64_SECRET" | base64 --decode > "$api_key_path"
343+
append_env "APPLE_API_KEY" "$api_key_path"
344+
append_env "APPLE_API_KEY_ID" "$APPLE_NOTARY_KEY_ID_SECRET"
345+
append_env "APPLE_API_ISSUER" "$APPLE_NOTARY_ISSUER_ID_SECRET"
346+
fi
347+
336348
append_env "CSC_LINK" "$mac_csc_link"
337349
append_env "CSC_KEY_PASSWORD" "$mac_csc_key_password"
338-
append_env "APPLE_ID" "$APPLE_ID_SECRET"
339-
append_env "APPLE_APP_SPECIFIC_PASSWORD" "$APPLE_APP_SPECIFIC_PASSWORD_SECRET"
340350
append_env "APPLE_TEAM_ID" "$APPLE_TEAM_ID_SECRET"
341351
echo "CSC_IDENTITY_AUTO_DISCOVERY=true" >> "$GITHUB_ENV"
342352
else

0 commit comments

Comments
 (0)