Branchwell

PulseCanvas / app · pulsecanvas.ai / scripts / sign-direct-release.sh

1#!/bin/bash
2set -euo pipefail
3cd "$(dirname "$0")/.."
4identity="${DEVELOPER_ID_APPLICATION:-Developer ID Application: Protomota, LLC (22HV69L32T)}"
5app="${1:-$PWD/build/direct/PulseCanvas Studio.app}"
6test -f "$app/Contents/MacOS/PulseCanvas"
7# iCloud requires an Apple-issued Developer ID profile. Never silently distribute
8# an unentitled app with a sync toggle that cannot connect.
9: "${PULSECANVAS_ICLOUD_PROFILE:?Set PULSECANVAS_ICLOUD_PROFILE to the iCloud-enabled Developer ID profile}"
10cloud_entitlements="$(dirname "$app")/creators-icloud.entitlements"
11python3 scripts/prepare-creators-icloud.py "$app" "$PULSECANVAS_ICLOUD_PROFILE" "$cloud_entitlements"
12# Include the installer artwork before the final app signature.
13cp packaging/macos/background.tiff "$app/Contents/Resources/PulseCanvasInstallerBackground.tiff"
14# Sign inside out. Preserve framework symlinks and sign every nested executable.
15framework="$app/Contents/Frameworks/Sparkle.framework/Versions/B"
16while IFS= read -r -d '' bundle; do
17 codesign --force --options runtime --timestamp --sign "$identity" "$bundle"
18done < <(find "$framework/XPCServices" -name '*.xpc' -type d -print0)
19codesign --force --options runtime --timestamp --sign "$identity" "$framework/Autoupdate"
20codesign --force --options runtime --timestamp --sign "$identity" "$framework/Updater.app"
21codesign --force --options runtime --timestamp --sign "$identity" "$app/Contents/Frameworks/Sparkle.framework"
22codesign --force --options runtime --timestamp --sign "$identity" "$app/Contents/Frameworks/libprojectM.dylib"
23codesign --force --options runtime --timestamp --entitlements "$cloud_entitlements" --sign "$identity" "$app"
24codesign --verify --deep --strict --verbose=2 "$app"
25python3 scripts/preset-provenance.py --app "$app"
26printf 'Developer ID signed app: %s\n' "$app"