From 0b45ae87fb0a339ab69de4de24691cc950c36fbd Mon Sep 17 00:00:00 2001 From: MarioHewardt Date: Mon, 20 Jul 2026 12:24:27 -0700 Subject: [PATCH] Add release version stamping --- README.md | 15 +++++++++++++++ Scripts/build-app.sh | 25 +++++++++++++++++++++++-- 2 files changed, 38 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index ce0bf13..98b8201 100644 --- a/README.md +++ b/README.md @@ -97,6 +97,21 @@ Testers should run the bundled app, not `swift run`. Build a release app bundle: zsh Scripts/build-app.sh release ``` +Local bundles default to version `1.0`. Set `ZOOMIT_VERSION` to stamp a +specific dotted-numeric version into both `CFBundleShortVersionString` and +`CFBundleVersion`: + +```sh +ZOOMIT_VERSION=1.2.0 zsh Scripts/build-app.sh release +defaults read "$PWD/.build/ZoomIt (Dev).app/Contents/Info" CFBundleShortVersionString +defaults read "$PWD/.build/ZoomIt (Dev).app/Contents/Info" CFBundleVersion +``` + +The official Azure DevOps build supplies `ZOOMIT_VERSION` from the version +entered when the pipeline is queued. Values must contain two or three numeric +components, such as `1.2` or `1.2.0`; malformed values fail before compilation +or signing begins. + By default this produces `.build/ZoomIt (Dev).app` with the app icon, bundled resources, and an `Info.plist` declaring the microphone and camera usage descriptions. `release` builds are **Universal** (Apple Silicon + Intel) by default; `debug` builds are native to the build machine for speed. Override the architectures with `ZOOMIT_ARCHS` (e.g. `ZOOMIT_ARCHS=arm64`). A Universal build routes through Xcode's build system, so it requires a **full Xcode** install — with only the Command Line Tools the script warns and falls back to a native build. The build summary prints the resulting architectures. ### Create and install a local development DMG diff --git a/Scripts/build-app.sh b/Scripts/build-app.sh index a383f47..ba00b29 100755 --- a/Scripts/build-app.sh +++ b/Scripts/build-app.sh @@ -6,6 +6,26 @@ CONFIGURATION="${1:-debug}" ICON_SOURCE="$ROOT_DIR/Sources/ZoomItMacCore/Resources/ZoomItColorIcon.png" ENTITLEMENTS="$ROOT_DIR/Scripts/ZoomIt.entitlements" +# Local builds default to 1.0 when ZOOMIT_VERSION is absent. An explicitly +# empty value still fails, which prevents a queued official build from silently +# using the development default. Restrict the value to dotted numeric +# components so it is valid for both macOS bundle version keys and cannot +# inject content into the generated plist. +VERSION="${ZOOMIT_VERSION-1.0}" +VERSION_PATTERN='^[0-9]+\.[0-9]+(\.[0-9]+)?$' +if [[ ! "$VERSION" =~ $VERSION_PATTERN ]]; then + echo "error: ZOOMIT_VERSION must be a dotted numeric version such as 1.0 or 1.0.0 (got '$VERSION')." >&2 + exit 2 +fi +case "${ZOOMIT_REQUIRE_RELEASE_VERSION:-false}" in + true|True|TRUE|1) + if [[ "$VERSION" == "0.0.0" ]]; then + echo "error: replace the 0.0.0 PR placeholder with the intended release version." >&2 + exit 2 + fi + ;; +esac + # Signing identity controls which "flavor" of the app is produced. # - Ad-hoc (the default, "-"): a contributor build that cannot reproduce the # official Developer ID signature. It uses a distinct .dev bundle id so its @@ -128,9 +148,9 @@ cat > "$APP_PATH/Contents/Info.plist" <CFBundlePackageType APPL CFBundleShortVersionString - 1.0 + $VERSION CFBundleVersion - 1 + $VERSION LSMinimumSystemVersion 14.0 LSUIElement @@ -170,5 +190,6 @@ fi echo "$APP_PATH" echo " bundle id: $BUNDLE_ID" >&2 echo " display name: $DISPLAY_NAME" >&2 +echo " version: $VERSION" >&2 echo " signed with: $SIGN_DESC" >&2 echo " architectures: $(lipo -archs "$APP_PATH/Contents/MacOS/ZoomIt" 2>/dev/null || echo unknown)" >&2 \ No newline at end of file