SPB Git

Repository Public License

package.sh 2.1 KB 37 lines shellscript

1#!/usr/bin/env bash2# ORIX OS Automation3# File: Scripts/release/package.sh4# Description: Builds dist/ORIX-OS-Automation-<version>.dmg (drag-to-install layout) and .zip from dist/ORIX OS Automation.app, signs the DMG and writes SHA-256 checksums.5#6# Author: Simon-Pierre Boucher7# Contact: contact@spboucher.ai8set -euo pipefail9cd "$(dirname "$0")/../.."10APP="dist/ORIX OS Automation.app"11[[ -d "$APP" ]] || { echo "ERROR: $APP not found." >&2; exit 1; }12VERSION="$(/usr/libexec/PlistBuddy -c 'Print CFBundleShortVersionString' "$APP/Contents/Info.plist")"13DMG="dist/ORIX-OS-Automation-$VERSION.dmg"; ZIP="dist/ORIX-OS-Automation-$VERSION.zip"14IDENTITY="$(codesign -dvv "$APP" 2>&1 | sed -n 's/^Authority=\(Developer ID Application: .*\)$/\1/p' | head -1)"15[[ -n "$IDENTITY" ]] || { echo "ERROR: the app is not signed with a Developer ID identity." >&2; exit 1; }16make_zip() { rm -f "$ZIP"; ditto -c -k --keepParent "$APP" "$ZIP"; echo "built $ZIP"; }17make_dmg() {18  [[ -x build/tools/dmg-background ]] || { mkdir -p build/tools; swiftc -O Scripts/tools/dmg-background.swift -o build/tools/dmg-background; }19  build/tools/dmg-background build/dmg-background.png20  local stage; stage="$(mktemp -d)"; ditto "$APP" "$stage/ORIX OS Automation.app"21  rm -f "$DMG"22  create-dmg --volname "ORIX OS Automation $VERSION" --background build/dmg-background.png --window-pos 200 160 --window-size 660 440 \23    --icon-size 128 --icon "ORIX OS Automation.app" 170 200 --app-drop-link 490 200 --hide-extension "ORIX OS Automation.app" --no-internet-enable \24    "$DMG" "$stage" >/dev/null 2>build/create-dmg.err || { [[ -f "$DMG" ]] || { cat build/create-dmg.err >&2; exit 1; }; }25  rm -rf "$stage"26  codesign --force --timestamp --sign "$IDENTITY" "$DMG"27  codesign --verify "$DMG"; echo "built and signed $DMG"28}29make_checksums() { ( cd dist && shasum -a 256 "$(basename "$DMG")" "$(basename "$ZIP")" | tee SHA256SUMS.txt ); }30case "${1:-all}" in31  zip) make_zip ;;32  dmg) make_dmg ;;33  checksums) make_checksums ;;34  all) make_zip; make_dmg; make_checksums ;;35  *) echo "usage: $0 zip|dmg|checksums|all" >&2; exit 2 ;;36esac37
Files main
Menu

Theme