Repository Public
1#!/bin/bash2# Builds the distribution artifacts from dist/ORIX Sheet.app:3# dist/ORIXSheet-<version>.dmg (drag-to-Applications layout with ORIX background, signed)4# dist/ORIXSheet-<version>.zip (the signed, stapled app)5set -euo pipefail6cd "$(dirname "$0")/.."7APP="dist/ORIX Sheet.app"8[[ -d "$APP" ]] || { echo "ERROR: $APP not found." >&2; exit 1; }9VERSION="$(/usr/libexec/PlistBuddy -c 'Print CFBundleShortVersionString' "$APP/Contents/Info.plist")"10DMG="dist/ORIXSheet-$VERSION.dmg"; ZIP="dist/ORIXSheet-$VERSION.zip"11IDENTITY="$(codesign -dvv "$APP" 2>&1 | sed -n 's/^Authority=\(Developer ID Application: .*\)$/\1/p' | head -1)"12rm -f "$DMG" "$ZIP"13ditto -c -k --keepParent "$APP" "$ZIP"14[[ -f design/dmg/background.png ]] || swift design/dmg/make-background.swift design/dmg15STAGE="$(mktemp -d)"16ditto "$APP" "$STAGE/ORIX Sheet.app"17if command -v create-dmg >/dev/null; then18 create-dmg --volname "ORIX Sheet $VERSION" --background design/dmg/background.png --window-pos 200 140 --window-size 660 420 \19 --icon-size 112 --icon "ORIX Sheet.app" 170 205 --app-drop-link 490 205 --hide-extension "ORIX Sheet.app" --no-internet-enable \20 "$DMG" "$STAGE" >/dev/null 2>&1 || true21fi22if [[ ! -f "$DMG" ]]; then23 echo "create-dmg unavailable or failed: building a plain disk image"24 ln -s /Applications "$STAGE/Applications"25 hdiutil create -volname "ORIX Sheet $VERSION" -srcfolder "$STAGE" -ov -format UDZO "$DMG" >/dev/null26fi27rm -rf "$STAGE"28[[ -n "$IDENTITY" ]] && codesign --force --timestamp --sign "$IDENTITY" "$DMG"29ls -lh "$DMG" "$ZIP" | awk '{print $5, $9, $10}'30