diff --git a/docs/platforms/mac/release.md b/docs/platforms/mac/release.md index 800f0164a86..31ee7819a82 100644 --- a/docs/platforms/mac/release.md +++ b/docs/platforms/mac/release.md @@ -27,7 +27,7 @@ This app now ships Sparkle auto-updates. Release builds must be Developer ID–s Notes: - `APP_BUILD` maps to `CFBundleVersion`/`sparkle:version`; keep it numeric + monotonic (no `-beta`), or Sparkle compares it as equal. -- If `APP_BUILD` is omitted, `scripts/package-mac-app.sh` derives a Sparkle-safe default from `APP_VERSION` (`YYYYMMDD0`) and uses the higher of that value and git commit count. +- If `APP_BUILD` is omitted, `scripts/package-mac-app.sh` derives a Sparkle-safe default from `APP_VERSION` (`YYYYMMDDNN`: stable defaults to `90`, prereleases use a suffix-derived lane) and uses the higher of that value and git commit count. - You can still override `APP_BUILD` explicitly when release engineering needs a specific monotonic value. - Defaults to the current architecture (`$(uname -m)`). For release/universal builds, set `BUILD_ARCHS="arm64 x86_64"` (or `BUILD_ARCHS=all`). - Use `scripts/package-mac-dist.sh` for release artifacts (zip + DMG + notarization). Use `scripts/package-mac-app.sh` for local/dev packaging. diff --git a/scripts/package-mac-app.sh b/scripts/package-mac-app.sh index 4ed4e258829..021eb85e4c1 100755 --- a/scripts/package-mac-app.sh +++ b/scripts/package-mac-app.sh @@ -35,7 +35,20 @@ canonical_build_from_version() { local year="${BASH_REMATCH[1]}" local month="${BASH_REMATCH[2]}" local day="${BASH_REMATCH[3]}" - printf "%d%02d%02d0" "$year" "$month" "$day" + local suffix="${BASH_REMATCH[4]:-}" + local lane=90 + # Keep stable releases above same-day prereleases so Sparkle can advance beta -> stable. + if [[ -n "$suffix" ]]; then + if [[ "$suffix" =~ ([0-9]+)$ ]]; then + lane=$((10#${BASH_REMATCH[1]})) + if (( lane > 89 )); then + lane=89 + fi + else + lane=1 + fi + fi + printf "%d%02d%02d%02d" "$year" "$month" "$day" "$lane" return 0 fi return 1