From 10713cb1cd8cccc6082182235c2d1c55c3b2312f Mon Sep 17 00:00:00 2001 From: Stephen Cooper <1970249+scooper4711@users.noreply.github.com> Date: Mon, 16 Nov 2026 11:49:52 +0100 Subject: [PATCH 1/2] docs: Number every build by the commits on main --- docs/specs/library-manager/requirements.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/specs/library-manager/requirements.md b/docs/specs/library-manager/requirements.md index 73b5098..e03a5e1 100644 --- a/docs/specs/library-manager/requirements.md +++ b/docs/specs/library-manager/requirements.md @@ -388,7 +388,8 @@ library listing. Field Guide reads two of them for deities' lore. 16.3 Both channels carry a privacy manifest (`PrivacyInfo.xcprivacy`) that declares no tracking and no collected data, and the two required-reason APIs the app uses: user defaults (`CA92.1`) and file timestamps (`C617.1`). 16.4 Both declare `ITSAppUsesNonExemptEncryption` as false, a copyright line, and the real version; the build number - (`BUILD_NUMBER`) is separate from the version and increases with every upload. + (`BUILD_NUMBER`) is separate from the version: it is the number of commits on main + (scripts/version.sh), the same on the Mac and the iPad, so it increases with every merge and every upload. 16.5 The App Store build's entitlements leave out the Downloads folder, which only the updater used; the sandbox, network client, chosen download folder, its bookmark and the App Group remain, each with a use to name in review. 16.6 `PRIVACY.md` is the privacy policy, linked from the Help menu on the Mac and from About on both platforms. From b5e7ed8b67b364bcb15cb7cb235deb80f9ecee14 Mon Sep 17 00:00:00 2001 From: Stephen Cooper <1970249+scooper4711@users.noreply.github.com> Date: Mon, 16 Nov 2026 11:56:04 +0100 Subject: [PATCH 2/2] chore: Number every build by the commits on main The build number is now the number of commits on main, read by scripts/version.sh, so every build carries one and it only grows. CI and release checkouts fetch the full history, which the count needs. --- .github/workflows/ci.yml | 3 ++ .github/workflows/release.yml | 3 ++ .gitignore | 1 + ios/Scrollkeeper.xcodeproj/project.pbxproj | 4 --- .../xcschemes/Scrollkeeper-iPad.xcscheme | 10 ++++++ ios/Signing.xcconfig | 9 ++++- scripts/build-app.sh | 11 +++--- scripts/version.sh | 34 +++++++++++++++++++ 8 files changed, 65 insertions(+), 10 deletions(-) create mode 100755 scripts/version.sh diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2ac1808..83e649f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,6 +18,9 @@ jobs: runs-on: macos-26 steps: - uses: actions/checkout@v7 + with: + # scripts/version.sh counts every commit for the build number. + fetch-depth: 0 - name: Show toolchain run: swift --version diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0145bc5..c239abe 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -22,6 +22,9 @@ jobs: RELEASING: ${{ startsWith(github.ref, 'refs/tags/') }} steps: - uses: actions/checkout@v7 + with: + # scripts/version.sh counts every commit for the build number. + fetch-depth: 0 - name: Derive the version from the tag if: env.RELEASING == 'true' diff --git a/.gitignore b/.gitignore index d2d26fb..1f9c1e8 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,4 @@ __pycache__/ ios/build/ *.xcworkspace/xcuserdata/ ios/Local.xcconfig +ios/Version.xcconfig diff --git a/ios/Scrollkeeper.xcodeproj/project.pbxproj b/ios/Scrollkeeper.xcodeproj/project.pbxproj index 518b545..641708b 100644 --- a/ios/Scrollkeeper.xcodeproj/project.pbxproj +++ b/ios/Scrollkeeper.xcodeproj/project.pbxproj @@ -252,7 +252,6 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_ENTITLEMENTS = Scrollkeeper.entitlements; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 1; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = Info.plist; INFOPLIST_KEY_CFBundleDisplayName = Scrollkeeper; @@ -267,7 +266,6 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 2.0.0; PRODUCT_NAME = "Scrollkeeper"; SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; SUPPORTS_MACCATALYST = NO; @@ -284,7 +282,6 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_ENTITLEMENTS = Scrollkeeper.entitlements; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 1; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = Info.plist; INFOPLIST_KEY_CFBundleDisplayName = Scrollkeeper; @@ -299,7 +296,6 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 2.0.0; PRODUCT_NAME = "Scrollkeeper"; SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; SUPPORTS_MACCATALYST = NO; diff --git a/ios/Scrollkeeper.xcodeproj/xcshareddata/xcschemes/Scrollkeeper-iPad.xcscheme b/ios/Scrollkeeper.xcodeproj/xcshareddata/xcschemes/Scrollkeeper-iPad.xcscheme index 21fc169..098c20a 100644 --- a/ios/Scrollkeeper.xcodeproj/xcshareddata/xcschemes/Scrollkeeper-iPad.xcscheme +++ b/ios/Scrollkeeper.xcodeproj/xcshareddata/xcschemes/Scrollkeeper-iPad.xcscheme @@ -1,6 +1,16 @@ + + + + + + + + + + diff --git a/ios/Signing.xcconfig b/ios/Signing.xcconfig index 3010001..4de2aa0 100644 --- a/ios/Signing.xcconfig +++ b/ios/Signing.xcconfig @@ -1,4 +1,4 @@ -// Signing settings for the iPad app. +// Signing and version settings for the iPad app. // // Put your own Apple developer team in Local.xcconfig next to this file. That file is not // committed, so nobody's team ends up in the repository: @@ -11,4 +11,11 @@ DEVELOPMENT_TEAM = PRODUCT_BUNDLE_IDENTIFIER = io.github.scooper4711.Scrollkeeper +// The version and build number come from git (scripts/version.sh): the Scrollkeeper-iPad scheme's build +// pre-action writes them to Version.xcconfig before every build, Product > Archive included. These are the +// fallbacks for a build that skips the scheme. +MARKETING_VERSION = 0.0.0 +CURRENT_PROJECT_VERSION = 1 +#include? "Version.xcconfig" + #include? "Local.xcconfig" diff --git a/scripts/build-app.sh b/scripts/build-app.sh index a4a53b3..1dfe564 100755 --- a/scripts/build-app.sh +++ b/scripts/build-app.sh @@ -1,19 +1,20 @@ #!/bin/sh # Builds "build/Scrollkeeper.app" from the Swift package. # -# VERSION version written to the bundle (default 0.0.0) +# VERSION version written to the bundle (default: scripts/version.sh marketing) # UNIVERSAL set to 1 to build for both Apple silicon and Intel # TEAM_ID the team that owns the App Group (default: read from the Developer ID certificate) # SIGNING_IDENTITY passed to scripts/sign-app.sh; "-" signs ad hoc, without the App Group # CHANNEL "appstore" builds the Mac App Store package (build/appstore/Scrollkeeper.pkg) from the same sources, # compiled with -DAPP_STORE so the updater and the Ko-fi link are left out; needs BUILD_NUMBER, TEAM_ID # and the variables of tabletop-kit's scripts/package-appstore.sh (TRIAL=1 checks it without them) -# BUILD_NUMBER CFBundleVersion, which must increase with every upload (default: VERSION) +# BUILD_NUMBER CFBundleVersion, which must increase with every upload (default: scripts/version.sh build) set -eu cd "$(dirname "$0")/.." -VERSION="${VERSION:-0.0.0}" +VERSION="${VERSION:-$(scripts/version.sh marketing)}" +BUILD_NUMBER="${BUILD_NUMBER:-$(scripts/version.sh build)}" APP="build/Scrollkeeper.app" EXECUTABLE="Scrollkeeper" @@ -101,7 +102,7 @@ cat > "$APP/Contents/Info.plist" <CFBundleShortVersionString $VERSION CFBundleVersion - ${BUILD_NUMBER:-$VERSION} + $BUILD_NUMBER ITSAppUsesNonExemptEncryption LSApplicationCategoryType @@ -136,7 +137,7 @@ if [ "${CHANNEL:-}" = "appstore" ]; then /usr/libexec/PlistBuddy -c "Delete :com.apple.security.files.downloads.read-write" "$ENTITLEMENTS" fi scripts/sign-app.sh "$APP" "$ENTITLEMENTS" -echo "Built $APP ($VERSION)" +echo "Built $APP ($VERSION, build $BUILD_NUMBER)" if [ "${CHANNEL:-}" = "appstore" ]; then # The App Store build has no updater and no outside payment link (guidelines 2.4.5(vii) and 3.1.1). diff --git a/scripts/version.sh b/scripts/version.sh new file mode 100755 index 0000000..60568c4 --- /dev/null +++ b/scripts/version.sh @@ -0,0 +1,34 @@ +#!/bin/sh +# Prints the app's version, taken from git so the iPad and Mac builds agree. +# +# scripts/version.sh marketing the newest release tag without its "v" (1.2.0), or 0.0.0 before the first +# scripts/version.sh build the build number: the commit count, which grows with every commit on main +# scripts/version.sh xcconfig both, as Xcode build settings (written to ios/Version.xcconfig) +set -eu + +cd "$(dirname "$0")/.." + +marketing() { + tag="$(git describe --tags --abbrev=0 --match 'v[0-9]*' 2>/dev/null || echo v0.0.0)" + echo "${tag#v}" +} + +build() { + # A shallow clone counts only the commits it fetched, which would make a build number go backwards. + if [ "$(git rev-parse --is-shallow-repository)" = "true" ]; then + echo "Reading the build number failed: the clone is shallow; fetch the full history." >&2 + exit 1 + fi + git rev-list --count HEAD +} + +case "${1:-}" in + marketing) marketing ;; + build) build ;; + xcconfig) + echo "// Written by scripts/version.sh; not committed." + echo "MARKETING_VERSION = $(marketing)" + echo "CURRENT_PROJECT_VERSION = $(build)" + ;; + *) echo "Usage: scripts/version.sh marketing|build|xcconfig" >&2; exit 2 ;; +esac