Repository Public
1#!/bin/bash2# NEXTERM release pipeline: Release build → Developer ID signing (hardened runtime) → DMG → notarization → staple.3# Credentials already on this Mac: identity "Developer ID Application: Simon-Pierre Boucher (3YM54G49SN)"4# and notarytool keychain profile "MacLustr-Notarize" (same Apple ID/team as the MacLustr app).5# Scripts/release.sh # everything6# Scripts/release.sh --skip-notarize7set -euo pipefail8cd "$(dirname "$0")/.."9IDENTITY="${IDENTITY:-Developer ID Application: Simon-Pierre Boucher (3YM54G49SN)}"10PROFILE="${NOTARY_PROFILE:-MacLustr-Notarize}"11VERSION=$(grep -E 'MARKETING_VERSION:' project.yml | head -1 | sed -E 's/.*"([^"]+)".*/\1/')12DIST=dist; mkdir -p "$DIST"13APP="$DIST/NEXTERM.app"; DMG="$DIST/NEXTERM-$VERSION.dmg"14SKIP_NOTARIZE=0; for a in "$@"; do [ "$a" = --skip-notarize ] && SKIP_NOTARIZE=1; done1516echo "== Release build $VERSION"17Scripts/build.sh release | tail -318rm -rf "$APP"; cp -R build/DerivedData/Build/Products/Release/NEXTERM.app "$APP"1920echo "== Sign (Developer ID, hardened runtime, timestamp)"21# Nested code first (SwiftPM products are statically linked, but sign anything present).22find "$APP/Contents" -type f \( -name "*.dylib" -o -perm -111 \) -not -path "*/MacOS/NEXTERM" -print0 | while IFS= read -r -d '' f; do23 codesign --force --options runtime --timestamp --sign "$IDENTITY" "$f"24done25codesign --force --options runtime --timestamp --entitlements Resources/NEXTERM.entitlements --sign "$IDENTITY" "$APP"26codesign --verify --deep --strict --verbose=2 "$APP"27spctl -a -vv -t exec "$APP" 2>&1 | tail -2 || true2829echo "== DMG"30rm -f "$DMG"; TMP=$(mktemp -d); cp -R "$APP" "$TMP/"; ln -s /Applications "$TMP/Applications"31hdiutil create -volname "NEXTERM" -srcfolder "$TMP" -ov -format UDZO "$DMG" >/dev/null; rm -rf "$TMP"32codesign --force --sign "$IDENTITY" --timestamp "$DMG"3334if [ "$SKIP_NOTARIZE" = 1 ]; then echo "skipping notarization; $DMG"; exit 0; fi35echo "== Notarize ($PROFILE)"36xcrun notarytool submit "$DMG" --keychain-profile "$PROFILE" --wait 2>&1 | tee "$DIST/notarize.log" | grep -E "id:|status:" | tail -337grep -q "status: Accepted" "$DIST/notarize.log" || { echo "notarization not accepted — see $DIST/notarize.log"; exit 1; }38xcrun stapler staple "$DMG" | tail -139xcrun stapler staple "$APP" | tail -140spctl -a -vv -t exec "$APP" 2>&1 | tail -241echo "OK: $DMG (notarized, stapled); app: $APP"42