This commit is contained in:
Mark Gregory
2026-10-21 14:26:24 +01:00
parent 8a6072d66e
commit ba66bab7bc
297 changed files with 1546 additions and 26 deletions
+33 -2
View File
@@ -17,7 +17,7 @@ done
# Choose a Developer ID Application identity unless explicitly provided.
IDENTITY="${SIGNING_IDENTITY:-}"
if [[ -z "$IDENTITY" ]]; then
IDENTITY="$(security find-identity -v -p codesigning 2>/dev/null | sed -nE 's/^ *[0-9]+\) [A-F0-9]+ "(Developer ID Application: [^"]+)".*/\1/p' | head -n 1)"
IDENTITY="$(security find-identity -v -p codesigning 2>/dev/null | awk '/Developer ID Application:/ {print $2; exit}')"
fi
if [[ -z "$IDENTITY" && "${ALLOW_UNSIGNED:-0}" != 1 ]]; then
print -u2 'No Developer ID Application identity found. Set SIGNING_IDENTITY or use ALLOW_UNSIGNED=1 for a local test package.'
@@ -51,8 +51,39 @@ ln -s /Applications "$STAGE/Applications"
rm -f "$DMG"
hdiutil create -volname "Pegasus Monitor" -srcfolder "$STAGE" -format UDZO -ov "$DMG" >/dev/null
# Assign the application icon to the DMG file in Finder.
ICON="$APP/Contents/Resources/AppIcon.icns"
if [[ -f "$ICON" ]]; then
/usr/bin/swift - "$ICON" "$DMG" <<'SWIFT'
import AppKit
import Foundation
let iconPath = CommandLine.arguments[1]
let dmgPath = CommandLine.arguments[2]
guard let image = NSImage(contentsOfFile: iconPath) else {
fatalError("Unable to load DMG icon")
}
guard NSWorkspace.shared.setIcon(
image,
forFile: dmgPath,
options: []
) else {
fatalError("Unable to assign DMG icon")
}
print("Custom DMG icon applied.")
SWIFT
fi
# Optional Apple notary profile, previously saved with `xcrun notarytool store-credentials`.
if [[ -n "${NOTARY_PROFILE:-}" ]]; then
if [[ -z "${NOTARY_PROFILE:-}" ]]; then
NOTARY_PROFILE="orion-notary"
fi
if [[ -n "$NOTARY_PROFILE" ]]; then
[[ -n "$IDENTITY" ]] || { print -u2 'Notarization requires a signed app.'; exit 1; }
print "Submitting for notarization with profile: $NOTARY_PROFILE"
xcrun notarytool submit "$DMG" --keychain-profile "$NOTARY_PROFILE" --wait
@@ -10,14 +10,14 @@ APP="$DERIVED/Build/Products/Release/PegasusMonitor.app"
DIST="$ROOT/dist"
[[ -d "$PROJECT" ]] || { print -u2 "Missing Xcode project: $PROJECT"; exit 1; }
for cmd in xcodebuild codesign hdiutil PlistBuddy; do
for cmd in xcodebuild codesign hdiutil; do
command -v "$cmd" >/dev/null || { print -u2 "Missing command: $cmd"; exit 1; }
done
# Choose a Developer ID Application identity unless explicitly provided.
IDENTITY="${SIGNING_IDENTITY:-}"
if [[ -z "$IDENTITY" ]]; then
IDENTITY="$(security find-identity -v -p codesigning 2>/dev/null | sed -nE 's/^ *[0-9]+\) [A-F0-9]+ "(Developer ID Application: [^"]+)".*/\1/p' | head -n 1)"
IDENTITY="$(security find-identity -v -p codesigning 2>/dev/null | awk '/Developer ID Application:/ {print $2; exit}')"
fi
if [[ -z "$IDENTITY" && "${ALLOW_UNSIGNED:-0}" != 1 ]]; then
print -u2 'No Developer ID Application identity found. Set SIGNING_IDENTITY or use ALLOW_UNSIGNED=1 for a local test package.'
@@ -10,14 +10,14 @@ APP="$DERIVED/Build/Products/Release/PegasusMonitor.app"
DIST="$ROOT/dist"
[[ -d "$PROJECT" ]] || { print -u2 "Missing Xcode project: $PROJECT"; exit 1; }
for cmd in xcodebuild codesign hdiutil PlistBuddy; do
for cmd in xcodebuild codesign hdiutil; do
command -v "$cmd" >/dev/null || { print -u2 "Missing command: $cmd"; exit 1; }
done
# Choose a Developer ID Application identity unless explicitly provided.
IDENTITY="${SIGNING_IDENTITY:-}"
if [[ -z "$IDENTITY" ]]; then
IDENTITY="$(security find-identity -v -p codesigning 2>/dev/null | sed -nE 's/^ *[0-9]+\) [A-F0-9]+ "(Developer ID Application: [^"]+)".*/\1/p' | head -n 1)"
IDENTITY="$(security find-identity -v -p codesigning 2>/dev/null | awk '/Developer ID Application:/ {print $2; exit}')"
fi
if [[ -z "$IDENTITY" && "${ALLOW_UNSIGNED:-0}" != 1 ]]; then
print -u2 'No Developer ID Application identity found. Set SIGNING_IDENTITY or use ALLOW_UNSIGNED=1 for a local test package.'
@@ -51,6 +51,33 @@ ln -s /Applications "$STAGE/Applications"
rm -f "$DMG"
hdiutil create -volname "Pegasus Monitor" -srcfolder "$STAGE" -format UDZO -ov "$DMG" >/dev/null
# Assign the application icon to the DMG file in Finder.
ICON="$APP/Contents/Resources/AppIcon.icns"
if [[ -f "$ICON" ]]; then
/usr/bin/swift - "$ICON" "$DMG" <<'SWIFT'
import AppKit
import Foundation
let iconPath = CommandLine.arguments[1]
let dmgPath = CommandLine.arguments[2]
guard let image = NSImage(contentsOfFile: iconPath) else {
fatalError("Unable to load DMG icon")
}
guard NSWorkspace.shared.setIcon(
image,
forFile: dmgPath,
options: []
) else {
fatalError("Unable to assign DMG icon")
}
print("Custom DMG icon applied.")
SWIFT
fi
# Optional Apple notary profile, previously saved with `xcrun notarytool store-credentials`.
if [[ -n "${NOTARY_PROFILE:-}" ]]; then
[[ -n "$IDENTITY" ]] || { print -u2 'Notarization requires a signed app.'; exit 1; }