Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions .github/workflows/apple-notarization-readiness.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Apple Notarization Readiness

on:
pull_request:
branches:
- main

permissions: {}

concurrency:
group: apple-notarization-${{ github.event.pull_request.number }}
cancel-in-progress: true

jobs:
readiness:
name: Apple notarization readiness
# This check must report on every pull request so it can be required on
# `main`. Only release PRs need the macOS-only notary service check; every
# other PR gets a fast no-op on Ubuntu.
runs-on: ${{ startsWith(github.head_ref, 'release-please--') && github.event.pull_request.head.repo.full_name == github.repository && 'macos-latest' || 'ubuntu-latest' }}
timeout-minutes: 10
permissions:
contents: read
steps:
- name: Not a release PR
if: ${{ !startsWith(github.head_ref, 'release-please--') || github.event.pull_request.head.repo.full_name != github.repository }}
run: echo "No Apple notarization check needed for this pull request."

- name: Checkout trusted verification script
if: ${{ startsWith(github.head_ref, 'release-please--') && github.event.pull_request.head.repo.full_name == github.repository }}
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
# Never execute pull request code with the Apple release secrets.
# The script comes from the base branch (main), not the release PR.
ref: ${{ github.event.pull_request.base.sha }}

- name: Verify Apple notarization access
if: ${{ startsWith(github.head_ref, 'release-please--') && github.event.pull_request.head.repo.full_name == github.repository }}
env:
APPLE_ID_USERNAME: ${{ secrets.APPLE_ID_USERNAME }}
APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }}
APPLE_ID_TEAM_ID: ${{ secrets.APPLE_ID_TEAM_ID }}
run: ./scripts/verifyAppleNotarization.sh
23 changes: 23 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,31 @@ on:
permissions: {}

jobs:
# Fail in seconds instead of after a build, sign, and notarize cycle. The
# release PR gate should already have caught this, but manual dispatches and
# expired agreements still deserve a clear, early error.
preflight:
name: Apple notarization preflight
runs-on: macos-latest
timeout-minutes: 10
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false

- name: Verify Apple notarization access
env:
APPLE_ID_USERNAME: ${{ secrets.APPLE_ID_USERNAME }}
APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }}
APPLE_ID_TEAM_ID: ${{ secrets.APPLE_ID_TEAM_ID }}
run: ./scripts/verifyAppleNotarization.sh

release:
name: Publish ${{ matrix.platform }} [electron-builder]
needs: preflight
permissions:
contents: write
strategy:
Expand Down
6 changes: 6 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,11 @@ Releases are automated with [release-please][release-please]. There is no releas

1. **Merge changes into `main`.** Use [Conventional Commits][conventional-commits] for PR titles (`feat:`, `fix:`, `docs:`, `chore(deps):`, ...). The commit type decides the version bump and the changelog section it lands in.
2. **Review the release PR.** release-please keeps an open `chore: release X.Y.Z` pull request up to date as commits land. It bumps the version in `package.json`, regenerates `CHANGELOG.md`, and updates `sonar.projectVersion` in `sonar-project.properties`. Check the [Renovate Dependency Dashboard][github-dependency-dashboard] for any dependency updates you want to include first.

Before merging, wait for the **Apple notarization readiness** check. It authenticates to Apple's notary service with the same credentials the release uses and fails when a required Apple agreement is missing or expired. Only the Account Holder can accept the [Apple Developer Program License Agreement](https://developer.apple.com/account) or a pending agreement in [App Store Connect](https://appstoreconnect.apple.com/business/agreements), so surface the failure to them instead of re-running the build.

release-please opens the PR with `GITHUB_TOKEN`, so GitHub holds its workflow runs for approval. A maintainer with write access must select **Approve workflows to run** before CI and the Apple check execute.

3. **Merge the release PR when you are ready to ship.** Merging is the "go" decision. GitHub Actions then automatically:

- builds, signs, and notarizes the app on macOS, Windows, and Linux,
Expand All @@ -238,6 +243,7 @@ No manual milestone creation, renaming, or closing is required.

#### 🔐 Release automation permissions

- release-please uses `GITHUB_TOKEN`, so its release PR workflow runs require approval from a user with write access.
- Packaging and publication use `contents: write`.
- The milestone automation uses `issues: write`.
- Pull request notification uses `issues: write`, `pull-requests: write`, and `contents: read`.
Expand Down
33 changes: 33 additions & 0 deletions scripts/verifyAppleNotarization.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/usr/bin/env bash
# Verify that the Apple credentials used by the release pipeline can reach the
# notary service and that all required Apple agreements are in effect.
#
# Apple exposes no API for pending agreement status, so `notarytool history` is
# the only reliable signal: it authenticates without submitting an artifact and
# returns the same 403 that a real notarization submission would. Retrying here
# would only hide propagation lag; a failed check is easier to understand and
# re-run once the agreement is actually in effect.
set -euo pipefail

: "${APPLE_ID_USERNAME:?APPLE_ID_USERNAME is required}"
: "${APPLE_ID_PASSWORD:?APPLE_ID_PASSWORD is required}"
: "${APPLE_ID_TEAM_ID:?APPLE_ID_TEAM_ID is required}"

if output=$(xcrun notarytool history \
--apple-id "${APPLE_ID_USERNAME}" \
--password "${APPLE_ID_PASSWORD}" \
--team-id "${APPLE_ID_TEAM_ID}" 2>&1); then
printf '%s\n' "${output}"
echo "Apple notarization access verified."
exit 0
fi

printf '%s\n' "${output}"

if grep -q "required agreement is missing or has expired" <<<"${output}"; then
echo "::error title=Apple agreement missing or expired::Notarization is blocked because a required Apple agreement is missing or expired. The Account Holder (not an Admin) must accept the pending agreement at https://developer.apple.com/account and any pending agreement at https://appstoreconnect.apple.com/business/agreements. If the agreement was just accepted, Apple can take a few minutes to propagate; re-run this check." >&2
exit 1
fi

echo "::error title=Apple notarization check failed::notarytool could not authenticate. Check that APPLE_ID_PASSWORD is an app-specific password and APPLE_ID_TEAM_ID matches the Developer ID team." >&2
exit 1
Loading