feat(app): wire Check for Updates to releases page, add DMG packaging script
About screen's "Check for Updates..." was a no-op placeholder - opens the Gitea releases page now (no Sparkle-style in-app updater yet). scripts/package-dmg.sh packages an Xcode-exported .app into a distributable DMG with an Applications symlink, versioned from the app's own Info.plist.
This commit is contained in:
@@ -1,8 +1,10 @@
|
|||||||
#if os(macOS)
|
#if os(macOS)
|
||||||
|
import AppKit
|
||||||
import SwiftUI
|
import SwiftUI
|
||||||
|
|
||||||
struct AboutView: View {
|
struct AboutView: View {
|
||||||
private let repositoryURL = URL(string: "https://git.psmattas.com/psmattas/Outpost")!
|
private let repositoryURL = URL(string: "https://git.psmattas.com/psmattas/Outpost")!
|
||||||
|
private let releasesURL = URL(string: "https://git.psmattas.com/psmattas/Outpost/releases")!
|
||||||
|
|
||||||
private var appName: String {
|
private var appName: String {
|
||||||
Bundle.main.object(forInfoDictionaryKey: "CFBundleName") as? String ?? "Outpost"
|
Bundle.main.object(forInfoDictionaryKey: "CFBundleName") as? String ?? "Outpost"
|
||||||
@@ -71,7 +73,10 @@ struct AboutView: View {
|
|||||||
.frame(width: 320)
|
.frame(width: 320)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update checking isn't wired to a distribution channel yet — button is a placeholder.
|
// No Sparkle-style in-app updater yet — this just opens the releases page
|
||||||
private func checkForUpdates() {}
|
// on the self-hosted Gitea instance so the user can check/download manually.
|
||||||
|
private func checkForUpdates() {
|
||||||
|
NSWorkspace.shared.open(releasesURL)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Executable
+46
@@ -0,0 +1,46 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Packages an already-exported Outpost.app into a distributable DMG with an
|
||||||
|
# Applications-folder symlink for drag-to-install.
|
||||||
|
#
|
||||||
|
# Usage: scripts/package-dmg.sh /path/to/Outpost.app [output-dir]
|
||||||
|
#
|
||||||
|
# Produces: <output-dir>/Outpost-<version>.dmg
|
||||||
|
# Version/build number are read directly from the app's own Info.plist, so
|
||||||
|
# this always matches whatever MARKETING_VERSION was set to at archive time.
|
||||||
|
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
APP_PATH="${1:?Usage: package-dmg.sh /path/to/Outpost.app [output-dir]}"
|
||||||
|
OUT_DIR="${2:-$(pwd)/dist}"
|
||||||
|
|
||||||
|
if [ ! -d "$APP_PATH" ]; then
|
||||||
|
echo "error: '$APP_PATH' not found or not a directory" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
APP_NAME="$(basename "$APP_PATH" .app)"
|
||||||
|
VERSION="$(defaults read "$APP_PATH/Contents/Info" CFBundleShortVersionString)"
|
||||||
|
BUILD="$(defaults read "$APP_PATH/Contents/Info" CFBundleVersion)"
|
||||||
|
|
||||||
|
mkdir -p "$OUT_DIR"
|
||||||
|
|
||||||
|
STAGING_DIR="$(mktemp -d)"
|
||||||
|
trap 'rm -rf "$STAGING_DIR"' EXIT
|
||||||
|
|
||||||
|
echo "Staging '$APP_NAME.app' ($VERSION build $BUILD)..."
|
||||||
|
cp -R "$APP_PATH" "$STAGING_DIR/"
|
||||||
|
ln -s /Applications "$STAGING_DIR/Applications"
|
||||||
|
|
||||||
|
DMG_NAME="${APP_NAME}-${VERSION}.dmg"
|
||||||
|
DMG_PATH="$OUT_DIR/$DMG_NAME"
|
||||||
|
rm -f "$DMG_PATH"
|
||||||
|
|
||||||
|
echo "Building $DMG_NAME..."
|
||||||
|
hdiutil create \
|
||||||
|
-volname "$APP_NAME $VERSION" \
|
||||||
|
-srcfolder "$STAGING_DIR" \
|
||||||
|
-ov \
|
||||||
|
-format UDZO \
|
||||||
|
"$DMG_PATH"
|
||||||
|
|
||||||
|
echo "Done: $DMG_PATH"
|
||||||
Reference in New Issue
Block a user