SPB Git

Repository Public

release-mac.sh 2.1 KB 29 lines shellscript

1#!/usr/bin/env bash2# Author: Simon-Pierre Boucher — contact@spboucher.ai3# File: Scripts/release-mac.sh4# Description: Archives Local Chat for macOS (Release, App Sandbox, Hardened Runtime) signed with the existing Developer ID Application identity and exports dist/Local Chat.app.5# Usage: Scripts/release-mac.sh     (then Scripts/notarize-mac.sh). Nothing secret is printed; no certificate is created.6set -euo pipefail7cd "$(dirname "$0")/.."8ROOT="$PWD"; APPNAME="Local Chat"; LOG="$ROOT/build/logs/release-mac.log"9mkdir -p build/logs dist10IDENTITY="$(security find-identity -v -p codesigning | sed -n 's/.*"\(Developer ID Application: [^"]*\)".*/\1/p' | head -1)"11[[ -n "$IDENTITY" ]] || { echo "ERROR: no 'Developer ID Application' identity in the keychain." >&2; exit 1; }12TEAM="$(sed -n 's/.*(\([A-Z0-9]\{10\}\)).*/\1/p' <<<"$IDENTITY")"13echo "Signing identity : $IDENTITY"14xcodegen generate --quiet15ARCHIVE="$ROOT/build/LocalChatMac.xcarchive"16rm -rf "$ARCHIVE" "$ROOT/dist/$APPNAME.app"17echo "Archiving (log: build/logs/release-mac.log)…"18if ! xcodebuild -workspace LocalChat.xcworkspace -scheme LocalChatMac -configuration Release -derivedDataPath build/DD-mac-release \19    -destination 'generic/platform=macOS' -archivePath "$ARCHIVE" -skipMacroValidation -skipPackagePluginValidation archive DEVELOPMENT_TEAM="$TEAM" >"$LOG" 2>&1; then20  grep -E "error:|ARCHIVE FAILED" "$LOG" | sort -u | head -30 >&2; echo "ERROR: archive failed, see $LOG" >&2; exit 121fi22ditto "$ARCHIVE/Products/Applications/$APPNAME.app" "$ROOT/dist/$APPNAME.app"23APP="dist/$APPNAME.app"24VERSION="$(/usr/libexec/PlistBuddy -c 'Print :CFBundleShortVersionString' "$APP/Contents/Info.plist")"; BUILD="$(/usr/libexec/PlistBuddy -c 'Print :CFBundleVersion' "$APP/Contents/Info.plist")"25echo "Built $APP  version $VERSION ($BUILD)  archs: $(lipo -archs "$APP/Contents/MacOS/$APPNAME")"26codesign --verify --deep --strict --verbose=2 "$APP" 2>&1 | tail -227codesign -d --entitlements - "$APP" 2>/dev/null | grep -c "app-sandbox" | sed 's/^/sandbox entitlement present: /'28codesign -dvv "$APP" 2>&1 | grep -E "flags|TeamIdentifier" | head -229
Files main
Menu

Theme