Skip to content

7.4 billion tokens per month. 34 free LLM providers. 635 free model endpoints. All behind one /v1 endpoint, plus any custom OpenAI-compatible endpoint. Smart routing, automatic failover, encrypted keys. Personal experimentation only.

TypeScript

Notarize the Mac build with an App Store Connect key, not an app password (#1034)

Tashfeen0ed621dbaf50
diff --git a/.github/workflows/desktop-release.yml b/.github/workflows/desktop-release.yml
index 58cc58aa..87ce13a9 100644
--- a/.github/workflows/desktop-release.yml
+++ b/.github/workflows/desktop-release.yml
@@ -119,11 +119,9 @@ jobs:
shell: bash
env:
CSC_LINK: ${{ secrets.MACOS_CSC_LINK }}
- APPLE_API_KEY: ${{ secrets.APPLE_API_KEY }}
+ APPLE_API_KEY_P8: ${{ secrets.APPLE_API_KEY_P8 }}
APPLE_API_KEY_ID: ${{ secrets.APPLE_API_KEY_ID }}
APPLE_API_ISSUER: ${{ secrets.APPLE_API_ISSUER }}
- APPLE_ID: ${{ secrets.APPLE_ID }}
- APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLE_APP_SPECIFIC_PASSWORD }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
APPLE_KEYCHAIN_PROFILE: ${{ secrets.APPLE_KEYCHAIN_PROFILE }}
run: |
@@ -139,25 +137,44 @@ jobs:
fi
has_api_key_creds=false
- if [ -n "${APPLE_API_KEY:-}" ] && [ -n "${APPLE_API_KEY_ID:-}" ] && [ -n "${APPLE_API_ISSUER:-}" ]; then
+ if [ -n "${APPLE_API_KEY_P8:-}" ] && [ -n "${APPLE_API_KEY_ID:-}" ] && [ -n "${APPLE_API_ISSUER:-}" ]; then
has_api_key_creds=true
fi
- has_apple_id_creds=false
- if [ -n "${APPLE_ID:-}" ] && [ -n "${APPLE_APP_SPECIFIC_PASSWORD:-}" ] && [ -n "${APPLE_TEAM_ID:-}" ]; then
- has_apple_id_creds=true
- fi
-
has_keychain_creds=false
if [ -n "${APPLE_KEYCHAIN_PROFILE:-}" ]; then
has_keychain_creds=true
fi
- if [ "$has_api_key_creds" != true ] && [ "$has_apple_id_creds" != true ] && [ "$has_keychain_creds" != true ]; then
- echo "Missing Apple notarization secrets. Provide APPLE_API_KEY/APPLE_API_KEY_ID/APPLE_API_ISSUER, APPLE_ID/APPLE_APP_SPECIFIC_PASSWORD/APPLE_TEAM_ID, or APPLE_KEYCHAIN_PROFILE."
+ if [ "$has_api_key_creds" != true ] && [ "$has_keychain_creds" != true ]; then
+ echo "Missing Apple notarization secrets. Provide APPLE_API_KEY_P8/APPLE_API_KEY_ID/APPLE_API_ISSUER (an App Store Connect API key), or APPLE_KEYCHAIN_PROFILE."
+ exit 1
+ fi
+ if [ "$has_api_key_creds" = true ] && [ -z "${APPLE_TEAM_ID:-}" ]; then
+ echo "APPLE_TEAM_ID is required alongside the API key so codesign picks the right Developer ID identity."
exit 1
fi
echo "signed=true" >> "$GITHUB_OUTPUT"
+ echo "apikey=$has_api_key_creds" >> "$GITHUB_OUTPUT"
+
+ # notarytool takes the App Store Connect key as a FILE (`--key <path>`), but
+ # a GitHub secret is a string, so the .p8 has to be materialised on disk
+ # first. $RUNNER_TEMP is job-scoped and wiped when the job ends, and the
+ # runner is ephemeral, so the key never outlives this build. Writing it
+ # before the package step (rather than inlining a path into that step's
+ # `env:`) keeps the "which credential wins" logic in one place.
+ - name: Write the App Store Connect API key
+ if: steps.maccreds.outputs.signed == 'true' && steps.maccreds.outputs.apikey == 'true'
+ shell: bash
+ env:
+ APPLE_API_KEY_P8: ${{ secrets.APPLE_API_KEY_P8 }}
+ run: |
+ set -euo pipefail
+ key_path="$RUNNER_TEMP/AuthKey.p8"
+ printf '%s\n' "$APPLE_API_KEY_P8" > "$key_path"
+ chmod 600 "$key_path"
+ # electron-builder reads APPLE_API_KEY as the path to hand notarytool.
+ echo "APPLE_API_KEY=$key_path" >> "$GITHUB_ENV"
- name: Package installer
shell: bash
@@ -166,14 +183,20 @@ jobs:
# release builds sign + notarize when the Apple secrets are configured
# (so the downloaded DMG opens without Gatekeeper's "damaged" quarantine
# block) and fall back to an unsigned DMG when they aren't.
+ #
+ # Notarization goes through the App Store Connect API key, not an
+ # app-specific password. electron-builder checks APPLE_ID FIRST and
+ # returns as soon as it is set, so leaving that pair configured would
+ # silently shadow the API key — the two cannot coexist. The API key
+ # also does not expire the way an app-specific password does.
CSC_IDENTITY_AUTODISCOVERY: ${{ matrix.os == 'macos-latest' && startsWith(github.ref, 'refs/tags/') && steps.maccreds.outputs.signed == 'true' && 'true' || 'false' }}
CSC_LINK: ${{ secrets.MACOS_CSC_LINK }}
CSC_KEY_PASSWORD: ${{ secrets.MACOS_CSC_KEY_PASSWORD }}
- APPLE_API_KEY: ${{ secrets.APPLE_API_KEY }}
+ # APPLE_API_KEY is deliberately absent here: the step above exports the
+ # on-disk key path through $GITHUB_ENV, and a step-level `env:` entry
+ # would override it with the raw PEM text.
APPLE_API_KEY_ID: ${{ secrets.APPLE_API_KEY_ID }}
APPLE_API_ISSUER: ${{ secrets.APPLE_API_ISSUER }}
- APPLE_ID: ${{ secrets.APPLE_ID }}
- APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLE_APP_SPECIFIC_PASSWORD }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
APPLE_KEYCHAIN: ${{ secrets.APPLE_KEYCHAIN }}
APPLE_KEYCHAIN_PROFILE: ${{ secrets.APPLE_KEYCHAIN_PROFILE }}
@@ -184,7 +207,7 @@ jobs:
# with "<dir> not a file" on any non-PR build (PR builds never hit it
# because electron-builder skips signing for pull requests). Drop empty
# signing vars so unsigned builds actually build unsigned.
- for v in CSC_LINK CSC_KEY_PASSWORD APPLE_API_KEY APPLE_API_KEY_ID APPLE_API_ISSUER APPLE_ID APPLE_APP_SPECIFIC_PASSWORD APPLE_TEAM_ID APPLE_KEYCHAIN APPLE_KEYCHAIN_PROFILE; do
+ for v in CSC_LINK CSC_KEY_PASSWORD APPLE_API_KEY APPLE_API_KEY_ID APPLE_API_ISSUER APPLE_TEAM_ID APPLE_KEYCHAIN APPLE_KEYCHAIN_PROFILE; do
if [ -z "${!v:-}" ]; then unset "$v"; fi
done
# Run electron-builder with desktop/ as its own project root. Invoked