diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9152140..f8a8258 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 21a8fdb..491de3d 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/docs/specs/app-store/requirements.md b/docs/specs/app-store/requirements.md index df42112..05131ab 100644 --- a/docs/specs/app-store/requirements.md +++ b/docs/specs/app-store/requirements.md @@ -6,7 +6,8 @@ are tabletop-kit's `scripts/package-appstore.sh` (its `appstore-build` spec). ## R1 The build - R1.1 `CHANNEL=appstore scripts/build-app.sh` (or `make appstore`) builds the package `build/appstore/Mapsmith.pkg` from the same sources as the disk image; Mapsmith has no updater or payment link to leave out. -- R1.2 The build number (`BUILD_NUMBER`) is apart from the version and increases with every upload. +- R1.2 The build number (`BUILD_NUMBER`) is apart from the version: it is the number of commits on main + (scripts/version.sh), so it increases with every merge and every upload. - R1.3 The bundle declares `ITSAppUsesNonExemptEncryption` as false, a copyright line and the real version. ## R2 Privacy diff --git a/scripts/build-app.sh b/scripts/build-app.sh index f0de6a5..7403684 100755 --- a/scripts/build-app.sh +++ b/scripts/build-app.sh @@ -3,18 +3,19 @@ # # Usage: scripts/build-app.sh [--install] (--install moves it to /Applications) # -# 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 -# BUILD_NUMBER CFBundleVersion, which must increase with every App Store upload (default: VERSION) +# BUILD_NUMBER CFBundleVersion, which must increase with every App Store upload (default: scripts/version.sh build) # CHANNEL "appstore" also builds the Mac App Store package, build/appstore/Mapsmith.pkg, with tabletop-kit's # scripts/package-appstore.sh (PACKAGER names another copy); needs TEAM_ID and that script's variables, # and TRIAL=1 checks it without them. Mapsmith has no updater or payment link, so the sources are the same. set -euo pipefail cd "$(dirname "$0")/.." -VERSION="${VERSION:-0.0.0}" +VERSION="${VERSION:-$(scripts/version.sh marketing)}" +BUILD_NUMBER="${BUILD_NUMBER:-$(scripts/version.sh build)}" APP="build/Mapsmith.app" EXECUTABLE="Mapsmith" @@ -36,7 +37,7 @@ cp Resources/AppIcon.icns "$APP/Contents/Resources/AppIcon.icns" cp Resources/container-migration.plist "$APP/Contents/Resources/container-migration.plist" cp ios/App/PrivacyInfo.xcprivacy "$APP/Contents/Resources/PrivacyInfo.xcprivacy" /usr/libexec/PlistBuddy -c "Set :CFBundleShortVersionString $VERSION" \ - -c "Set :CFBundleVersion ${BUILD_NUMBER:-$VERSION}" "$APP/Contents/Info.plist" + -c "Set :CFBundleVersion $BUILD_NUMBER" "$APP/Contents/Info.plist" # The entitlements turn on the App Sandbox. A build signed with the team's Developer ID also joins the Tableside # Toolkit's App Group, where Scrollkeeper shares its library: the team's ID takes the place of TEAM_ID. The team ID # is read from the signing certificate, or from TEAM_ID in the environment. An ad hoc @@ -53,7 +54,7 @@ else /usr/libexec/PlistBuddy -c "Delete :com.apple.security.application-groups" "$ENTITLEMENTS" fi scripts/sign-app.sh "$APP" "$ENTITLEMENTS" -echo "Built $APP ($VERSION)" +echo "Built $APP ($VERSION, build $BUILD_NUMBER)" if [[ "${CHANNEL:-}" == "appstore" ]]; then # Found beside the package after "swift package resolve", so the script follows the dependency pin.