Fail the release script when notarization does not happen

A missing key or a skipped notarization used to exit 0 with a sha256,
which made an unnotarized build look publishable. Releases now fail
loudly unless spctl confirms a notarized build, and the skip flag warns
that its output must not be published.

💘 Generated with Crush

Assisted-by: Crush:kimi-k3
This commit is contained in:
2026-10-08 10:06:25 +08:00
parent 466c49e4b0
commit 88780f7701
2 changed files with 35 additions and 16 deletions
+19 -8
View File
@@ -105,15 +105,26 @@ Bundle id is `dev.tzgyn.prompt`.
## Release process ## Release process
1. `./release.sh <version>` — builds, zips `Prompt.app` to `dist/Prompt.zip`, Notarization is **required**: an unnotarized build is not a release. Never
and prints its sha256 (it does not tag or upload). Notarizes when the publish one, and never suggest quarantine workarounds (`xattr -dr
`PROMPT_NOTARY_*` env vars (or the shared Kapture App Store Connect key at com.apple.quarantine`, `brew install --cask --no-quarantine`). `release.sh`
`~/.config/kapture/AuthKey_K5KXMMSB28.p8`) are present; set enforces this — it fails if it cannot notarize, and refuses to print a sha256
`PROMPT_SKIP_NOTARY=1` to skip. unless `spctl` reports `source=Notarized Developer ID`. `PROMPT_SKIP_NOTARY=1`
exists only for a local dev build and prints a "NOT FOR PUBLICATION" warning.
1. `./release.sh <version>` — builds, notarizes, staples, zips `Prompt.app` to
`dist/Prompt.zip`, and prints its sha256 (it does not tag or upload). Uses
the `PROMPT_NOTARY_*` env vars, defaulting to the shared Kapture App Store
Connect key at `~/.config/kapture/AuthKey_K5KXMMSB28.p8`.
2. Commit and push `main`. 2. Commit and push `main`.
3. `tea releases create --tag v<version> --asset dist/Prompt.zip --repo TZGyn/prompt --login gitea.tzgyn.dev`. 3. `tea releases create --tag v<version> --title "Prompt <version>" --note "<what changed>" --asset dist/Prompt.zip --repo TZGyn/prompt --login gitea.tzgyn.dev`.
4. Bump `version`/`sha256` in `~/.cache/homebrew-tap/Casks/prompt.rb`, push, 4. Add/update `~/.cache/homebrew-tap/Casks/prompt.rb` (`version` + `sha256`),
then `git -C /opt/homebrew/Library/Taps/tzgyn/homebrew-tap pull --ff-only`. push the tap, then
`git -C /opt/homebrew/Library/Taps/tzgyn/homebrew-tap pull --ff-only` and
`brew audit --cask tzgyn/tap/prompt`.
5. Verify by downloading the release asset back, comparing the sha256 with the
cask, and unzipping with `ditto -x -k` (not `unzip`, which adds `._*` files
and breaks the signature check) then `spctl -a -vv Prompt.app`.
**Always print the upgrade script after any release or version bump:** **Always print the upgrade script after any release or version bump:**
+16 -8
View File
@@ -23,7 +23,8 @@ ditto -c -k --keepParent Prompt.app dist/Prompt.zip
if [ -n "${PROMPT_SKIP_NOTARY:-}" ]; then if [ -n "${PROMPT_SKIP_NOTARY:-}" ]; then
echo echo
echo "Skipping notarization (PROMPT_SKIP_NOTARY set)." echo "!! NOTARIZATION SKIPPED — this zip is NOT FOR PUBLICATION."
echo "!! It is signed but Gatekeeper will reject it on other Macs."
shasum -a 256 dist/Prompt.zip shasum -a 256 dist/Prompt.zip
exit 0 exit 0
fi fi
@@ -34,15 +35,16 @@ PROMPT_NOTARY_API_KEY_ID="${PROMPT_NOTARY_API_KEY_ID:-K5KXMMSB28}"
PROMPT_NOTARY_API_ISSUER="${PROMPT_NOTARY_API_ISSUER:-3e25e5dc-8b75-453f-a71c-c7f3feaac628}" PROMPT_NOTARY_API_ISSUER="${PROMPT_NOTARY_API_ISSUER:-3e25e5dc-8b75-453f-a71c-c7f3feaac628}"
if [ ! -f "$PROMPT_NOTARY_API_KEY_PATH" ]; then if [ ! -f "$PROMPT_NOTARY_API_KEY_PATH" ]; then
echo "Notarization skipped — key not found at $PROMPT_NOTARY_API_KEY_PATH." >&2 echo "ERROR: notarization key not found at $PROMPT_NOTARY_API_KEY_PATH." >&2
shasum -a 256 dist/Prompt.zip echo "Notarization is required for a release; set PROMPT_SKIP_NOTARY=1 only" >&2
exit 0 echo "for a local dev build that must not be published." >&2
exit 1
fi fi
if ! command -v xcrun >/dev/null 2>&1 || ! xcrun --find notarytool >/dev/null 2>&1; then if ! command -v xcrun >/dev/null 2>&1 || ! xcrun --find notarytool >/dev/null 2>&1; then
echo "Notarization skipped — xcrun notarytool not found (requires Xcode 13+)." >&2 echo "ERROR: xcrun notarytool not found (requires Xcode 13+)." >&2
shasum -a 256 dist/Prompt.zip echo "Notarization is required for a release." >&2
exit 0 exit 1
fi fi
echo "Submitting to Apple for notarization (first run can take minutes)..." echo "Submitting to Apple for notarization (first run can take minutes)..."
@@ -69,6 +71,12 @@ xcrun stapler validate Prompt.app
rm -f dist/Prompt.zip rm -f dist/Prompt.zip
ditto -c -k --keepParent Prompt.app dist/Prompt.zip ditto -c -k --keepParent Prompt.app dist/Prompt.zip
if ! spctl -a -vv Prompt.app 2>&1 | grep -q "source=Notarized Developer ID"; then
echo "ERROR: spctl does not report a notarized build — do not publish this." >&2
spctl -a -vv Prompt.app >&2
exit 1
fi
echo echo
echo "Done — notarized." echo "Done — notarized and stapled."
shasum -a 256 dist/Prompt.zip shasum -a 256 dist/Prompt.zip