From 0aa929b2f577ef5b91dde842732014335feaa66f Mon Sep 17 00:00:00 2001 From: "mula.liu" Date: Tue, 27 Oct 2026 18:49:21 +0800 Subject: [PATCH] build: bake release key into macOS packages --- docs/RELEASE.md | 6 +++--- scripts/build-macos-release.sh | 13 +++++++++++++ 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/docs/RELEASE.md b/docs/RELEASE.md index 59a32be..213eafa 100644 --- a/docs/RELEASE.md +++ b/docs/RELEASE.md @@ -211,9 +211,9 @@ scripts/publish-release.sh --key "$SHIFT_RELEASE_KEY" ``` Give the release build `SHIFT_UPDATE_PUBKEY` (the hex key) and it can verify the feed; give -it `SHIFT_RELEASE_KEY` (the private key) and `build-windows-release.sh` derives the public -key from it, so a cross-build can never be packaged with a key that does not match the -signature `publish-release.sh --key` produces. Without either, the script prints +it `SHIFT_RELEASE_KEY` (the private key) and both release scripts derive the public key from +it, so a build can never be packaged with a key that does not match the signature +`publish-release.sh --key` produces. Without either, the script prints `no release key: this build will report the feed as unsigned` rather than letting it pass for a quieter log. diff --git a/scripts/build-macos-release.sh b/scripts/build-macos-release.sh index 85b826e..362e066 100755 --- a/scripts/build-macos-release.sh +++ b/scripts/build-macos-release.sh @@ -12,6 +12,14 @@ cd "$(dirname "$0")/.." export PATH="$HOME/.cargo/bin:$HOME/.rustup/toolchains/stable-aarch64-apple-darwin/bin:$PATH" export RUSTUP_TOOLCHAIN=stable-aarch64-apple-darwin +# Keep the same trust anchor in both platform builds when the release key is +# available. A keyless build still installs updates, but cannot verify the +# manifest signature. +if [ -z "${SHIFT_UPDATE_PUBKEY:-}" ] && [ -n "${SHIFT_RELEASE_KEY:-}" ]; then + SHIFT_UPDATE_PUBKEY=$(python3 scripts/release-key.py pubkey "${SHIFT_RELEASE_KEY%.ed25519}.pub") + export SHIFT_UPDATE_PUBKEY +fi + SKIP_BUILD=0 usage() { echo "usage: $0 [--skip-build]" >&2 && exit 2; } while [ $# -gt 0 ]; do @@ -28,6 +36,11 @@ APP="$BUNDLE_DIR/macos/Shift.app" OUTPUT="artifacts/Shift-$VERSION-macOS-universal.dmg" if [ "$SKIP_BUILD" != "1" ]; then + if [ -n "${SHIFT_UPDATE_PUBKEY:-}" ]; then + echo "== release key baked in: ${SHIFT_UPDATE_PUBKEY:0:12}… ==" + else + echo "== no release key: this build will report the feed as unsigned ==" + fi pnpm mac:drag-bridge pnpm tauri build --target universal-apple-darwin --bundles app,dmg fi