SPB Git

Repository Public License

package.sh 2.9 KB 59 lines shellscript

1#!/usr/bin/env bash2# Release packaging: Developer ID signature, hardened runtime, Apple notarization, stapled DMG.3# Uses the signing identity and notarytool keychain profile already on this Mac (owner's standing instruction, 2026-11-22).4#   scripts/package.sh            build, sign, notarize app + DMG, staple, assess5#   PRISM_SKIP_NOTARIZE=1 …      sign only (no upload to Apple)6set -euo pipefail7cd "$(dirname "$0")/.."8IDENTITY="${PRISM_SIGN_IDENTITY:-Developer ID Application: Simon-Pierre Boucher (3YM54G49SN)}"9PROFILE="${PRISM_NOTARY_PROFILE:-MacLustr-Notarize}"10VERSION="$(cat VERSION)"11APP="build/release/PRISM.app"12DIST="dist"13DMG="$DIST/PRISM-$VERSION.dmg"1415security find-identity -v -p codesigning | grep -q "$IDENTITY" || { echo "Signing identity not found: $IDENTITY" >&2; exit 1; }16scripts/build.sh release17mkdir -p "$DIST" build/notary1819# Inside-out: the embedded satellite host first, then PRISM. Hardened runtime, secure timestamp, no entitlements needed.20sign() { codesign --force --options runtime --timestamp --sign "$IDENTITY" "$1"; }21sign "$APP/Contents/Resources/SatelliteHost.app"22sign "$APP"23codesign --verify --deep --strict --verbose=2 "$APP" 2>&1 | tail -224codesign -dvv "$APP" 2>&1 | grep -E "^(Identifier|Authority=Developer ID Application|TeamIdentifier|Runtime Version|Timestamp)"2526notarize() { # artifact, label27  local out="build/notary/$2.json"28  xcrun notarytool submit "$1" --keychain-profile "$PROFILE" --wait --output-format json > "$out"29  local id status30  id="$(/usr/bin/python3 -c 'import json,sys; print(json.load(open(sys.argv[1]))["id"])' "$out")"31  status="$(/usr/bin/python3 -c 'import json,sys; print(json.load(open(sys.argv[1]))["status"])' "$out")"32  xcrun notarytool log "$id" --keychain-profile "$PROFILE" "build/notary/$2-log.json" >/dev/null 2>&1 || true33  [ "$status" = "Accepted" ] || { echo "RESULT: $1 was NOT notarized (status $status). See build/notary/$2-log.json" >&2; exit 3; }34  echo "RESULT: $1 notarized by Apple (submission $id)."35}3637if [ "${PRISM_SKIP_NOTARIZE:-}" != "1" ]; then38  ZIP="build/notary/PRISM-app.zip"; rm -f "$ZIP"39  ditto -c -k --keepParent "$APP" "$ZIP"40  notarize "$ZIP" app41  xcrun stapler staple "$APP"42fi4344# DMG with the app and an Applications shortcut.45STAGE="$(mktemp -d)"; cp -R "$APP" "$STAGE/PRISM.app"; ln -s /Applications "$STAGE/Applications"46rm -f "$DMG"47hdiutil create -volname "PRISM $VERSION" -srcfolder "$STAGE" -ov -format UDZO "$DMG" >/dev/null48rm -rf "$STAGE"49codesign --force --timestamp --sign "$IDENTITY" "$DMG"50if [ "${PRISM_SKIP_NOTARIZE:-}" != "1" ]; then51  notarize "$DMG" dmg52  xcrun stapler staple "$DMG"53  xcrun stapler validate "$DMG"54  spctl --assess --type open --context context:primary-signature -v "$DMG" 2>&1 | tail -255  spctl --assess --type execute -v "$APP" 2>&1 | tail -256fi57( cd "$DIST" && shasum -a 256 "PRISM-$VERSION.dmg" > "PRISM-$VERSION.dmg.sha256" && cat "PRISM-$VERSION.dmg.sha256" )58echo "Packaged $DMG"59
Files main
Menu

Theme