Skip to content

Commit 164fd98

Browse files
fix(release): make Android version codes unique per release
Agent-Logs-Url: https://github.com/richardthe3rd/cambridge-beer-festival-app/sessions/0fcb3cb1-c21f-4e98-885c-f6d452263726 Co-authored-by: richardthe3rd <573334+richardthe3rd@users.noreply.github.com>
1 parent 59a1f14 commit 164fd98

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

.github/workflows/release-pr.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,9 @@ jobs:
4040
PATCH=$((PATCH + 1))
4141
fi
4242
VERSION="${YEAR}.${MONTH}.${PATCH}"
43-
BUILD=$(date +'%Y%m%d')
43+
# Keep Android versionCode unique even for multiple releases on the same day.
44+
# Formula: YYYYMMDD * 100 + patch (e.g. 20260517 * 100 + 7 = 2026051707)
45+
BUILD=$(( $(date +'%Y%m%d') * 100 + PATCH ))
4446
echo "version=${VERSION}" >> $GITHUB_OUTPUT
4547
echo "tag=v${VERSION}" >> $GITHUB_OUTPUT
4648
echo "pubspec_version=${VERSION}+${BUILD}" >> $GITHUB_OUTPUT

docs/processes/release.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ This project uses **CalVer** (`YYYY.M.patch`) for versioning. Releases are fully
77
| Component | Format | Example |
88
|-----------|--------|---------|
99
| Version name | `YYYY.M.patch` | `2026.5.2` |
10-
| Build number | `YYYYMMDD` (release date) | `20260509` |
11-
| pubspec.yaml | `version: YYYY.M.patch+YYYYMMDD` | `2026.5.2+20260509` |
10+
| Build number | `YYYYMMDDPP` (`date * 100 + patch`) | `2026050902` |
11+
| pubspec.yaml | `version: YYYY.M.patch+YYYYMMDDPP` | `2026.5.2+2026050902` |
1212
| Git tag | `vYYYY.M.patch` | `v2026.5.2` |
1313

1414
Patch number resets to `0` each month. Increment for each release within a month (`2026.5.0`, `2026.5.1`, …).
@@ -29,7 +29,7 @@ The PR is skipped if there are no releasable commits (i.e. only `chore`/`ci`/`te
2929

3030
> **Note — CI on the release PR**: GitHub does not trigger workflow runs on PRs created by `GITHUB_TOKEN`, so the usual test/analysis checks will not run on `release/next`. This is acceptable because the shipped code is identical to what already passed CI on `main`; only `pubspec.yaml` (version bump) and `CHANGELOG.md` (generated text) differ. If you want CI to run, supply a PAT as `secrets.RELEASE_TOKEN` and pass it via `token:` in the `create-pull-request` step.
3131
32-
> **Note — build date**: The `+YYYYMMDD` build suffix in `pubspec.yaml` is computed when the release PR is last updated (on each push to `main` and the daily 06:00 UTC cron). If you merge the PR several hours after the cron ran, the build date may be up to ~24 hours behind the actual merge date. This is cosmetic only.
32+
> **Note — Android versionCode uniqueness**: The `+YYYYMMDDPP` build suffix in `pubspec.yaml` is computed as `date * 100 + patch`, so multiple releases on the same day still get unique Play Store version codes.
3333
3434
### 2. Review and merge the release PR
3535

0 commit comments

Comments
 (0)