build(release): add release.sh and 0.1.0 release notes

scripts/release.sh cuts a release from an already-bumped commit:
archive → Developer ID export → UDZO DMG → notarytool → stapler,
refusing before any build when the Developer ID identity is missing
(the private key lives only on the Mac that created the certificate).
diskutil image create replaces hdiutil create, deprecated on macOS 27.

CHANGELOG.md stays the entry-by-entry record with issue numbers;
docs/releases/<version>.md is the human-readable distillation pasted
into the Gitea release (DOX contract in docs/AGENTS.md). dist/ is
gitignored. Root AGENTS.md: commands block, scripts index row, and the
Stack line corrected to macOS 27+ to match MACOSX_DEPLOYMENT_TARGET.
This commit is contained in:
AlexKucera committed 2026-12-01 12:31:32 +01:00
1 parent c10477da35
commit 58355aa292
5 files changed
+164 -2

No files matched your search

+103
View File
@@ -0,0 +1,103 @@
#!/usr/bin/env bash
# Release packaging: archive → Developer ID export → DMG → notarize → staple.
#
# Contract:
# - Bumps nothing and tags nothing. Run from the commit that already carries
# the version in MARKETING_VERSION; the git tag is the caller's job.
# - Refuses BEFORE building when no valid "Developer ID Application" identity
# is in the keychain (Xcode ▸ Settings ▸ Accounts ▸ Manage Certificates… ▸ +).
# The private key lives only on the Mac that created the certificate — a
# portal-side certificate without it is not an identity.
# - Notarizes through the `museion-notary` notarytool keychain profile, created
# once by the Account Holder:
# xcrun notarytool store-credentials museion-notary \
# --apple-id <apple-id> --team-id <team-id> --password <app-specific-password>
# NOTARIZE=0 skips notarize+staple (a Developer-ID-signed DMG Gatekeeper still warns on).
# - Output: dist/Museion-<MARKETING_VERSION>.dmg (gitignored). The version is
# read from build settings, never from the pbxproj text. Apple Silicon only —
# the deployment target is macOS 27, which does not run on Intel.
set -euo pipefail
PROJECT="Museion.xcodeproj"
SCHEME="Museion"
APP_NAME="Museion.app"
CONFIGURATION="Release"
IDENTITY="Developer ID Application"
NOTARY_PROFILE="museion-notary"
DIST="dist"
DESTINATION='platform=macOS,arch=arm64'
cd "$(dirname "$0")/.." # repo root — PROJECT is relative (same guard as deploy.sh)
if ! security find-identity -v -p codesigning | grep -q "\"$IDENTITY:"; then
echo "No valid \"$IDENTITY\" identity in the keychain." >&2
echo "Create it once: Xcode ▸ Settings ▸ Accounts ▸ Manage Certificates… ▸ + ▸ $IDENTITY" >&2
exit 1
fi
VERSION=$(xcodebuild -project "$PROJECT" -scheme "$SCHEME" -configuration "$CONFIGURATION" \
-destination "$DESTINATION" -showBuildSettings 2>/dev/null \
| awk -F'= ' '/MARKETING_VERSION = / {print $2; exit}')
if [[ -z "$VERSION" ]]; then
echo "MARKETING_VERSION not found in build settings" >&2
exit 1
fi
TEAM=$(xcodebuild -project "$PROJECT" -scheme "$SCHEME" -configuration "$CONFIGURATION" \
-destination "$DESTINATION" -showBuildSettings 2>/dev/null \
| awk -F'= ' '/DEVELOPMENT_TEAM = / {print $2; exit}')
DMG="$DIST/Museion-$VERSION.dmg"
echo "Packaging $SCHEME $VERSION"
# xcodebuild -quiet prints nothing on success; keep the log to show on failure.
log=$(mktemp -t museion-release)
trap 'rm -f "$log"' EXIT
run() { echo "→ $*"; if ! "$@" >"$log" 2>&1; then echo "Failed: $*" >&2; cat "$log" >&2; exit 1; fi; }
rm -rf "$DIST"
mkdir -p "$DIST"
run xcodebuild -project "$PROJECT" -scheme "$SCHEME" -configuration "$CONFIGURATION" \
-destination "$DESTINATION" -archivePath "$DIST/Museion.xcarchive" -quiet archive
cat >"$DIST/export-options.plist" <<EOF
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0"><dict>
<key>method</key><string>developer-id</string>
<key>signingStyle</key><string>automatic</string>
<key>teamID</key><string>$TEAM</string>
<key>destination</key><string>export</string>
</dict></plist>
EOF
run xcodebuild -exportArchive -archivePath "$DIST/Museion.xcarchive" \
-exportOptionsPlist "$DIST/export-options.plist" -exportPath "$DIST/export" \
-allowProvisioningUpdates -quiet
APP="$DIST/export/$APP_NAME"
if [[ ! -d "$APP" ]]; then
echo "Export did not produce $APP" >&2
exit 1
fi
run codesign --verify --deep --strict "$APP"
codesign -dvv "$APP" 2>&1 | grep -q '^Authority=Developer ID Application' \
|| { echo "Export is not Developer ID signed:" >&2; codesign -dvv "$APP" 2>&1 | grep '^Authority=' >&2; exit 1; }
# A mounted leftover from an earlier run makes the create fail with a busy volume.
hdiutil detach "/Volumes/$SCHEME $VERSION" -quiet 2>/dev/null || true
STAGE="$DIST/stage"
mkdir -p "$STAGE"
ditto "$APP" "$STAGE/$APP_NAME" # ditto preserves the bundle's signature and xattrs
ln -s /Applications "$STAGE/Applications"
# diskutil image create replaces the deprecated `hdiutil create` (macOS 27).
run diskutil image create from --format UDZO --volumeName "$SCHEME $VERSION" "$STAGE" "$DMG"
rm -rf "$STAGE" "$DIST/export"
if [[ "${NOTARIZE:-1}" == "1" ]]; then
run xcrun notarytool submit "$DMG" --keychain-profile "$NOTARY_PROFILE" --wait
run xcrun stapler staple "$DMG"
# The Gatekeeper verdict a downloader's Mac will reach.
spctl -a -t open --context context:primary-signature -v "$DMG"
fi
echo "Built: $DMG"