Repository Public License
1#!/usr/bin/env bash2# ORIX Clean — Scripts/package.sh3# Description: Builds the distribution artifacts from the notarized, stapled dist/ORIX Clean.app:4# a signed DMG (background artwork, Applications shortcut), a ZIP, SHA-256 checksums and release metadata.5# The DMG must then be notarized: Scripts/notarize.sh dist/ORIXClean-<version>.dmg dmg6# Author: Simon-Pierre Boucher — contact@spboucher.ai7set -euo pipefail8cd "$(dirname "$0")/.."9APP="dist/ORIX Clean.app"10[[ -d "$APP" ]] || { echo "ERROR: $APP not found." >&2; exit 1; }11xcrun stapler validate "$APP" >/dev/null 2>&1 || { echo "ERROR: the app is not notarized and stapled yet (Scripts/notarize.sh)." >&2; exit 1; }12VERSION="$(/usr/libexec/PlistBuddy -c 'Print CFBundleShortVersionString' "$APP/Contents/Info.plist")"13BUILD="$(/usr/libexec/PlistBuddy -c 'Print CFBundleVersion' "$APP/Contents/Info.plist")"14DMG="dist/ORIXClean-$VERSION.dmg"; ZIP="dist/ORIXClean-$VERSION.zip"15IDENTITY="$(codesign -dvv "$APP" 2>&1 | sed -n 's/^Authority=\(Developer ID Application: .*\)$/\1/p' | head -1)"16rm -f "$DMG" "$ZIP"17swift Scripts/dmg-background.swift build/dmg-background.png >/dev/null18STAGE="$(mktemp -d)"; ditto "$APP" "$STAGE/ORIX Clean.app"19create-dmg --volname "ORIX Clean $VERSION" --background build/dmg-background.png --window-pos 200 140 --window-size 660 420 \20 --icon-size 128 --icon "ORIX Clean.app" 170 205 --app-drop-link 490 205 --hide-extension "ORIX Clean.app" --no-internet-enable \21 "$DMG" "$STAGE" >/dev/null 2>&1 || { echo "create-dmg failed; falling back to a plain image" >&2; ln -s /Applications "$STAGE/Applications"; hdiutil create -volname "ORIX Clean $VERSION" -srcfolder "$STAGE" -ov -format UDZO "$DMG" >/dev/null; }22rm -rf "$STAGE"23codesign --force --timestamp --sign "$IDENTITY" "$DMG"24ditto -c -k --keepParent "$APP" "$ZIP"25echo "built $DMG and $ZIP (version $VERSION build $BUILD). Notarize the DMG next, then run: Scripts/finalize.sh"26