Release: sign and notarize the macOS app (#5749) (#6016)

* Release: sign and notarize the macOS app with a Developer ID (#5749)

package.sh --sign signs the app, the CLI and the DMG with the hardened runtime and a secure
timestamp, notarizes the DMG and the CLI zip, staples the DMG and checks it with stapler and
spctl. The app carries entitlements.plist: com.apple.security.cs.disable-library-validation
lets the hardened runtime load 3Dconnexion's client framework (crates/threedx-client).

signing.sh --setup imports the certificate into a temporary keychain and writes the API key;
--cleanup removes both. The release workflow builds both architectures first (macos-build, no
secrets), then signs and packages in the join job. Without the APPLE_* secrets (forks, dry runs)
the app keeps its ad-hoc signature and the job summary says so.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

* macOS release: staple the app before the DMG, retry stapler, document renewal (#5749)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Mikalai Kukhta
2026-10-25 11:15:35 +00:00
committed by GitHub
parent 0312808b92
commit 4e2270517a
6 changed files with 329 additions and 20 deletions
+41 -2
View File
@@ -128,8 +128,9 @@ change release infrastructure does not itself request publication of the applica
and an example model on an available platform. Inspect the package-check job output for
other platforms; report any platform you could not exercise yourself.
3. Review the generated notes. Add a concise description of features, fixes, breaking changes,
and known limitations. Keep the installation instructions. Packages are currently unsigned;
do not claim otherwise. Resolve failed checks or missing artifacts before publication.
and known limitations. Keep the installation instructions. The macOS app is Developer ID
signed and notarized only when the build summary says so; other packages are unsigned. Do not
claim otherwise. Resolve failed checks or missing artifacts before publication.
4. Publish the verified draft using `gh` or the equivalent GitHub release API. For example:
```sh
@@ -246,6 +247,44 @@ When the token expires, create a new one the same way and run step 2 again. If a
published while the secret was missing or expired, submit it afterwards with
`gh workflow run winget.yml -R bherbruck/solidcraft -f tag=v<version>`.
## macOS signing and notarization
`packaging/macos/package.sh` signs with the hardened runtime and notarizes when the release
workflow has these repository secrets; without them (forks, dry runs) it keeps the ad-hoc
signature and the job summary says so:
| Secret | Content |
| --- | --- |
| `APPLE_CERTIFICATE_P12` | base64 of the **Developer ID Application** certificate and key, exported as `.p12` |
| `APPLE_CERTIFICATE_PASSWORD` | password of that `.p12` |
| `APPLE_API_KEY_P8` | text of the App Store Connect API key (`AuthKey_<id>.p8`) |
| `APPLE_API_KEY_ID` | the key's ID |
| `APPLE_API_ISSUER` | the issuer ID (App Store Connect > Users and Access > Integrations) |
`packaging/macos/signing.sh --setup` imports the certificate into a temporary keychain after the
build, and `--cleanup` removes it at the end of the job.
The app is signed with `packaging/macos/entitlements.plist`. Its
`com.apple.security.cs.disable-library-validation` entitlement lets the hardened runtime load
3Dconnexion's `3DconnexionClient.framework` (`crates/threedx-client/src/macos.rs`); without it
the 3D mouse silently stops working. Test a notarized build with a real 3D mouse before
publishing. The script notarizes the app (a zip of it) and staples it before the `.dmg` is made,
so a copy dragged to /Applications opens offline. It then notarizes and staples the `.dmg`, and
notarizes the CLI `.zip` (a zip can't be stapled). `stapler staple` is retried, because it can
fail with error 65 for a while after Apple accepts a submission. The checks are `stapler validate`
and `spctl` on the `.dmg`, and `spctl --assess` on the mounted app. To try it
locally, pass `--sign` and set `MACOS_SIGN_IDENTITY` and the `APPLE_API_KEY_PATH`, `APPLE_API_KEY_ID`,
`APPLE_API_ISSUER` variables and run the script.
The certificate expires in **November 2027**. To renew it, create a new Developer ID Application
certificate in the Apple Developer account, export it with its key as a `.p12`, and replace
`APPLE_CERTIFICATE_P12` and `APPLE_CERTIFICATE_PASSWORD`. Releases built before the expiry stay
valid, because the signature carries a secure timestamp.
Signing currently uses a maintainer's **personal** Developer ID, so downloads show that person's
name, not an organisation's. Moving to an organisation account means replacing the certificate
and the API key secrets (`APPLE_API_KEY_P8`, `APPLE_API_KEY_ID`, `APPLE_API_ISSUER`).
## Update signing
The app's **Update now** (docs/book/src/guide/updates.md) only installs a package whose SHA-256