Repository navigation
feat(release): build signed, notarized macOS DMGs from a tag - #30
Merged
Merged
Conversation
This repository had no release pipeline: ci.yml packaged an unsigned .app on Ubuntu and discarded it, and the signing path in forge.config.ts was inert because nothing supplied SIGN_IDENTITY. Restore the client half of the stuffbucket/macos-builder contract, adapted to the pnpm/turbo monorepo layout rather than maximal's npm/client/ layout: - .macos-builder/config declares what to build and owns the asset name. - .macos-builder/build.sh builds and inside-out signs only the .app. It bootstraps pnpm at the packageManager version into scratch rather than asking the builder to supply it, repairs the lockfile before installing, stamps the tag version after installing, bypasses the cached turbo `package` task so a cache hit cannot restore a foreign bundle, and asserts Developer ID plus hardened runtime locally instead of letting Apple reject it minutes later. - release.yml goes tag -> draft -> dispatch -> wait -> verify. It never publishes; publishing stays deliberate and manual. The dispatch job holds no repository permissions and sits behind the `release` environment. - scripts/verify-dmg.sh is the Gatekeeper acceptance test. It applies a quarantine attribute explicitly, because neither gh nor curl sets one and a check on an unquarantined file proves nothing about what a user gets. No Apple credential enters this repository. The builder keeps the keychain, the Apple ID and the notary credentials, and is handed only a signing identity name and an entitlements path. The tag is the single owner of the version: the client manifest stays at 0.0.0 and is stamped at build time, so a tag and a bundle version cannot disagree. Release branches are not adopted yet; release.yml already accepts a tag on either main or release/*, so adopting them needs no workflow change.
Three defects found by exercising the failure paths:
- `${BUN_INSTALL:-}/bin` collapses to `/bin` when the variable is absent, which
silently prepends /bin to PATH. Guard each prepend on the variable actually
being set.
- Use `if` rather than `test && export`. Under set -e a trailing AND-OR list
whose test fails carries its non-zero status out, so the && form is safe only
at the exact position it currently occupies.
- `bun --version` in the preflight log aborted with no explanation when bun was
missing, pre-empting the named assertion below it. Tolerate it there and add
an explicit `command -v bun` check that says what is wrong.
All five input-validation paths verified to produce a named ::error::.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Restores the client half of the
stuffbucket/macos-buildercontract, adapted to this repo's pnpm/turbo monorepo layout. Nothing inmacos-builderis modified.What lands
.macos-builder/config.macos-builder/build.sh.app.github/workflows/release.ymlscripts/verify-dmg.shRELEASING.mdAGENTS.mdowns the rulesDesign notes worth reviewing
build.shreadspackageManager, installs that exact version withnpm install --prefixinto scratch from outside the checkout, then asserts the version. Not corepack — it is unbundled from Node 25.packagescript isturbo run package, whose task declaresoutputs: ["out/**", ".vite/**"], so a cache hit could restore a bundle the release never built. Forge is invoked directly with a pinned--arch.pnpm runanywhere in the producer. Under this workspace it re-resolves and rewrites rotatingms-feed-Nhosts into the lockfile before the script body runs (pnpm run re-resolves the lockfile, poisoning the Docker test context #26), which would poison the lockfilestrip-lockfile-hosts.mjshad just repaired.codesign -dvvmust showAuthority=Developer ID Applicationandflags=…runtime, and must not showSignature=adhoc. Without this, a bad signature surfaces as an opaque Apple rejection minutes later with no local evidence.gh release edit --draft=falsestays a deliberate manual act after the acceptance test.dispatchholdspermissions: {}and sits behind thereleaseenvironment. Its only capability is starting a build; it cannot touch this repository.verify-dmg.shsets the quarantine bit itself. Neitherghnorcurlsetscom.apple.quarantine— only download-aware apps do — so a Gatekeeper check on a freshly downloaded file otherwise runs against something macOS already trusts.Verification
Local rehearsal of the build half on this layout (unsigned, since
forge.config.tsskipsosxSignwithoutSIGN_IDENTITY):turbo run build --filter maximal-client --force→ sidecar compiled, embeds HEAD64b9106electron-forge package --arch=arm64→packages/maximal/client/out/Maximal-darwin-arm64/Maximal.app, matchingapp_pathexactlyCFBundleIdentifier=co.stuffbucket.maximal;CFBundleShortVersionString= the stamped tag versionapp.asarnonemptySignature=adhoc/TeamIdentifier=not set, which is precisely what the three new signing assertions reject — they are liveAlso:
actionlintclean on both workflows,shellcheckclean on all 9run:blocks and both scripts,verify-workspace14/14, lockfile unchanged with 0 recorded hosts.The signing, notarization and stapling tail cannot be rehearsed here — it only exists on the builder.
Not done in this PR
Onboarding is human-only and the pipeline degrades safely without it: with no
MACOS_BUILDER_PATthe dispatch job emits a notice, leaves the draft unfilled, and stays green.clients/stuffbucket/monimal.policyin the builder, via itsbuild-configissue-ops flowapp-repomaninstalled here with Contents: read+writeMACOS_BUILDER_PAT(fine-grained, Actions: write on the builder only)releaseenvironment restricted to tag refs with a required reviewerChecklist and rationale are in
RELEASING.md.