SPB Git

Repository Public

package.sh 1.8 KB 26 lines shellscript

1#!/usr/bin/env bash2# ORIX Sonata3# File: Scripts/package.sh4# Description: Builds the distribution artifacts from the notarized, stapled dist/ORIX Sonata.app: a signed DMG with an Applications shortcut, a ZIP and SHA256SUMS.txt. The DMG must then be notarized: Scripts/notarize.sh dist/ORIX-Sonata-<version>.dmg dmg5#6# Author: Simon-Pierre Boucher7# Contact: contact@spboucher.ai8set -euo pipefail9cd "$(dirname "$0")/.."10APP="dist/ORIX Sonata.app"11[[ -d "$APP" ]] || { echo "ERROR: $APP not found." >&2; exit 1; }12xcrun stapler validate "$APP" >/dev/null 2>&1 || { echo "ERROR: the app is not notarized and stapled yet (Scripts/notarize.sh)." >&2; exit 1; }13VERSION="$(/usr/libexec/PlistBuddy -c 'Print CFBundleShortVersionString' "$APP/Contents/Info.plist")"14BUILD="$(/usr/libexec/PlistBuddy -c 'Print CFBundleVersion' "$APP/Contents/Info.plist")"15DMG="dist/ORIX-Sonata-$VERSION.dmg"; ZIP="dist/ORIX-Sonata-$VERSION.zip"16IDENTITY="$(codesign -dvv "$APP" 2>&1 | sed -n 's/^Authority=\(Developer ID Application: .*\)$/\1/p' | head -1)"17rm -f "$DMG" "$ZIP"18STAGE="$(mktemp -d)"; ditto "$APP" "$STAGE/ORIX Sonata.app"19create-dmg --volname "ORIX Sonata $VERSION" --window-pos 200 140 --window-size 660 420 \20  --icon-size 128 --icon "ORIX Sonata.app" 170 205 --app-drop-link 490 205 --hide-extension "ORIX Sonata.app" --no-internet-enable \21  "$DMG" "$STAGE" >/dev/null 2>&1 || { echo "WARNING: create-dmg failed; building a plain image"; rm -f "$DMG"; ln -s /Applications "$STAGE/Applications"; hdiutil create -volname "ORIX Sonata $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). Next: Scripts/notarize.sh \"$DMG\" dmg ; then Scripts/build-release.sh verify"26
Files main
Menu

Theme