SPB Git

Repository Public License

notarize.sh 1.6 KB 28 lines shellscript

1#!/usr/bin/env bash2# ORIX Clean — Scripts/notarize.sh3# Description: Notarizes dist/ORIX Clean.app with an EXISTING notarytool keychain profile and staples the ticket.4#              NOTARY_PROFILE defaults to MacLustr-Notarize. Never creates, prints or changes credentials.5#              The word "notarized" is printed only when Apple's service answered Accepted.6# Author: Simon-Pierre Boucher — contact@spboucher.ai7set -euo pipefail8cd "$(dirname "$0")/.."9PROFILE="${NOTARY_PROFILE:-MacLustr-Notarize}"10TARGET="${1:-dist/ORIX Clean.app}"11NAME="${2:-app}"12[[ -e "$TARGET" ]] || { echo "ERROR: $TARGET not found. Run Scripts/sign.sh first." >&2; exit 1; }13mkdir -p build/notary14SUBMIT="$TARGET"15if [[ -d "$TARGET" ]]; then SUBMIT="build/notary/$NAME.zip"; rm -f "$SUBMIT"; ditto -c -k --keepParent "$TARGET" "$SUBMIT"; fi16OUT="build/notary/$NAME.json"17if ! xcrun notarytool submit "$SUBMIT" --keychain-profile "$PROFILE" --wait --output-format json >"$OUT" 2>"$OUT.err"; then18  echo "Notary service refused the submission:" >&2; head -8 "$OUT.err" >&2; exit 219fi20STATUS="$(/usr/bin/python3 -c 'import json,sys; print(json.load(open(sys.argv[1])).get("status",""))' "$OUT")"21ID="$(/usr/bin/python3 -c 'import json,sys; print(json.load(open(sys.argv[1])).get("id",""))' "$OUT")"22echo "submission $ID: $STATUS"23xcrun notarytool log "$ID" --keychain-profile "$PROFILE" "build/notary/$NAME-log.json" >/dev/null 2>&1 || true24[[ "$STATUS" == "Accepted" ]] || { echo "RESULT: NOT notarized. See build/notary/$NAME-log.json" >&2; exit 3; }25xcrun stapler staple "$TARGET"26xcrun stapler validate "$TARGET"27echo "RESULT: $TARGET is notarized by Apple (submission $ID) and stapled."28
Files main
Menu

Theme