From 1bcd8c79297be704c749a84eab34bf0ca71e27b6 Mon Sep 17 00:00:00 2001 From: Benjamin BERTRAND <8989169+benjaminbrtrd@users.noreply.github.com> Date: Sun, 15 Nov 2026 20:59:34 +0100 Subject: [PATCH 1/2] Sign and notarize the macOS builds The release workflow signs the macOS app with the Developer ID certificate and notarizes it with an App Store Connect API key when the six APPLE_* secrets exist; without them the build stays unsigned, as before. CONTRIBUTING lists the secrets and how to check a signed build. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/release.yml | 38 +++++++++++++++++++++++++++++++++++ CONTRIBUTING.md | 15 ++++++++++++++ 2 files changed, 53 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8bb4ad7..a0ab2ad 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -98,6 +98,40 @@ jobs: working-directory: ui run: npm ci + # Signs the app with the Developer ID certificate and notarizes it with an App Store Connect API key, so + # macOS opens it without a warning. Only when the secrets are set: without them the build stays unsigned + # (forks, or before the certificate is added). Tauri imports the certificate into a temporary keychain. + - name: Apple signing and notarization + if: runner.os == 'macOS' + env: + APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE }} + APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }} + APPLE_SIGNING_IDENTITY: ${{ secrets.APPLE_SIGNING_IDENTITY }} + APPLE_API_ISSUER: ${{ secrets.APPLE_API_ISSUER }} + APPLE_API_KEY: ${{ secrets.APPLE_API_KEY }} + APPLE_API_PRIVATE_KEY: ${{ secrets.APPLE_API_PRIVATE_KEY }} + run: | + if [ -z "$APPLE_CERTIFICATE" ] || [ -z "$APPLE_CERTIFICATE_PASSWORD" ] || [ -z "$APPLE_SIGNING_IDENTITY" ]; then + echo "::warning::No Apple Developer ID certificate in the secrets: this macOS build is not signed." + exit 0 + fi + # Multiline-safe: a value can't end the block early or add another variable. + put() { printf '%s<<__CUBBY_ENV__\n%s\n__CUBBY_ENV__\n' "$1" "$2" >> "$GITHUB_ENV"; } + # A base64 tool may wrap its output: the certificate must be one line. + put APPLE_CERTIFICATE "$(printf '%s' "$APPLE_CERTIFICATE" | tr -d ' \r\n')" + put APPLE_CERTIFICATE_PASSWORD "$APPLE_CERTIFICATE_PASSWORD" + put APPLE_SIGNING_IDENTITY "$APPLE_SIGNING_IDENTITY" + if [ -z "$APPLE_API_ISSUER" ] || [ -z "$APPLE_API_KEY" ] || [ -z "$APPLE_API_PRIVATE_KEY" ]; then + echo "::warning::No App Store Connect API key in the secrets: this macOS build is signed but not notarized." + exit 0 + fi + key_path="$RUNNER_TEMP/AuthKey_$APPLE_API_KEY.p8" + printf '%s\n' "$APPLE_API_PRIVATE_KEY" > "$key_path" + chmod 600 "$key_path" + put APPLE_API_ISSUER "$APPLE_API_ISSUER" + put APPLE_API_KEY "$APPLE_API_KEY" + put APPLE_API_KEY_PATH "$key_path" + - uses: tauri-apps/tauri-action@v0 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -115,6 +149,10 @@ jobs: # The manifest job writes latest.json once every build is there (four jobs writing it at once lose entries). includeUpdaterJson: false + - name: Remove the App Store Connect key + if: always() && runner.os == 'macOS' + run: rm -f "$RUNNER_TEMP"/AuthKey_*.p8 + # SHA256SUMS.txt for every installer of the release, and a signed build attestation for each one: anyone can # check that a file comes from this repository's workflow (gh attestation verify --repo /). # When Windows signing arrives, the installer is replaced before this job runs, so the sums describe the signed file. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 735e9f0..2f6d10d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -45,6 +45,21 @@ The interface is in English for now. Write it the way the app already speaks: 2. Write the notes in `.github/releases/v.md`, with a screenshot of what's new. 3. Push a tag such as `v2026.11.0`. GitHub Actions builds a draft release. +### Signing the macOS app + +The release workflow signs the macOS builds with a Developer ID certificate and notarizes them, when these repository secrets exist (without them the builds are unsigned and macOS warns on first launch): + +| Secret | What it holds | +| --- | --- | +| `APPLE_CERTIFICATE` | The *Developer ID Application* certificate and its private key, exported from Keychain Access as a `.p12`, in base64 (`base64 -i cert.p12 \| pbcopy`). | +| `APPLE_CERTIFICATE_PASSWORD` | The password chosen when exporting the `.p12`. | +| `APPLE_SIGNING_IDENTITY` | The certificate's name, e.g. `Developer ID Application: Jane Doe (AB12CD34EF)` (`security find-identity -v -p codesigning`). | +| `APPLE_API_ISSUER` | App Store Connect › Users and Access › Integrations › App Store Connect API: the *Issuer ID*. | +| `APPLE_API_KEY` | The *Key ID* of a Team key with the Developer role. | +| `APPLE_API_PRIVATE_KEY` | The content of that key's `AuthKey_.p8` file (it can be downloaded only once). | + +The first three sign; the last three notarize. Check a signed build with `spctl -a -vv /Applications/Cubby.app`: it should say *accepted* and *source=Notarized Developer ID*. + ## License By contributing, you agree that your work is released under the [GPL-3.0](LICENSE), like the rest of Cubby. From c76b7cdf3fad6cec747681d98b6f25d9989408a1 Mon Sep 17 00:00:00 2001 From: Benjamin BERTRAND <8989169+benjaminbrtrd@users.noreply.github.com> Date: Sun, 15 Nov 2026 21:15:57 +0100 Subject: [PATCH 2/2] Notarize and staple the macOS disk images too Tauri notarizes the app inside the .dmg but not the .dmg: submit it with the same App Store Connect key, staple the ticket and replace the asset in the release, before the checksums job runs. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/release.yml | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a0ab2ad..d022384 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -149,6 +149,34 @@ jobs: # The manifest job writes latest.json once every build is there (four jobs writing it at once lose entries). includeUpdaterJson: false + # Tauri notarizes the app, not the disk image around it: notarize and staple the .dmg too, so nothing in the + # install shows a warning, then put it in the release in place of the one tauri-action uploaded (the + # checksums job runs after this one, so its sums describe the stapled file). + - name: Notarize the disk image + if: runner.os == 'macOS' && env.APPLE_API_KEY_PATH != '' + env: + GH_TOKEN: ${{ github.token }} + TAG: ${{ inputs.tag || github.ref_name }} + run: | + shopt -s nullglob + dmgs=(target/${{ matrix.target }}/release/bundle/dmg/*.dmg) + if [ ${#dmgs[@]} -eq 0 ]; then + echo "::error::No .dmg was built." + exit 1 + fi + for dmg in "${dmgs[@]}"; do + result=$(xcrun notarytool submit "$dmg" --key "$APPLE_API_KEY_PATH" --key-id "$APPLE_API_KEY" --issuer "$APPLE_API_ISSUER" --wait --timeout 30m --output-format json) + status=$(jq -r '.status' <<< "$result") + if [ "$status" != "Accepted" ]; then + echo "::error::Apple did not notarize $(basename "$dmg"): $status" + xcrun notarytool log "$(jq -r '.id' <<< "$result")" --key "$APPLE_API_KEY_PATH" --key-id "$APPLE_API_KEY" --issuer "$APPLE_API_ISSUER" || true + exit 1 + fi + xcrun stapler staple "$dmg" + spctl -a -vv -t open --context context:primary-signature "$dmg" + gh release upload "$TAG" "$dmg" --clobber + done + - name: Remove the App Store Connect key if: always() && runner.os == 'macOS' run: rm -f "$RUNNER_TEMP"/AuthKey_*.p8