Skip to content
Merged
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
66 changes: 66 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand All @@ -115,6 +149,38 @@ 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

# 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 <file> --repo <owner>/<repo>).
# When Windows signing arrives, the installer is replaced before this job runs, so the sums describe the signed file.
Expand Down
15 changes: 15 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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<version>.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_<Key ID>.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.
Loading