Repository navigation
feat(release): support Apple-style build numbers for Play releases - #103
Conversation
Play has no marketing-version/build-number split — versionCode is the only
monotonic counter — so re-dispatching the same version recomputed the same
code and Play rejected it as a duplicate. Shipping a fix therefore forced an
invented patch bump, unlike silo-apple where one marketing version carries
many builds.
versionName is a free-form display string that may repeat, so the build
number can live in the versionCode instead:
base = 100_000_000 + (major*10000 + minor*100 + patch)*1000 + build
Gradle still ships phone = base*2 and TV = base*2+1, unchanged. The
100_000_000 epoch lifts every code above the largest the previous
major*1e6+minor*1e3+patch scheme could emit (v1.0.1 shipped 2000002/2000003),
so the switchover stays strictly increasing.
Dispatch gains a build_number input; tags accept +N build metadata
(v1.0.0+2). Build 1 keeps the bare vX.Y.Z tag, later builds get their own so
GitHub releases never collide. SILO_VERSION_NAME now carries the plain
major.minor.patch, since a v1.0.0+2 tag would fail the Fastfile's strict
version regex.
Bounds: major <= 94, minor/patch <= 99, build <= 999. At 94.99.99 build 999
the base is exactly Gradle's 1_049_999_999 cap and the TV code is
2_099_999_999, just under Play's 2_100_000_000 ceiling.
Verified: the workflow shell and the Fastfile produce identical codes across
14 version/build combinations, both reject the same 6 invalid inputs, and
Gradle accepts 110000001 and 1049999999 while rejecting 1050000000.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
📝 WalkthroughWalkthroughThe release pipeline now accepts rerelase build numbers, derives separate marketing and Play version values, supports prerelease and build-metadata tags, validates version bounds, and passes the new outputs through Fastlane and APK assembly. ChangesRelease versioning
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant ReleaseTrigger
participant SetupJob
participant FastlaneBeta
participant PlayConsole
participant GitHubRelease
ReleaseTrigger->>SetupJob: version and build_number or release tag
SetupJob->>SetupJob: validate and derive version outputs
SetupJob->>FastlaneBeta: version_name, build_number, version_code, play_publish
FastlaneBeta->>PlayConsole: publish when play_publish is enabled
SetupJob->>GitHubRelease: create tagged release artifacts
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.github/workflows/release.yml:
- Around line 103-132: Canonicalize build-number validation in both release
layers: in .github/workflows/release.yml lines 103-132, require dispatch and tag
build metadata to match a nonzero, non-padded decimal format such as
[1-9][0-9]*; in fastlane/Fastfile lines 78-83, apply the same validation before
converting the build value with to_i. Preserve rejection of zero, nonnumeric,
and zero-padded values so distinct inputs cannot share a versionCode.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: db2ca57b-a4fc-449b-ba43-72a9d4b23b2c
📒 Files selected for processing (3)
.github/workflows/release.ymlAGENTS.mdfastlane/Fastfile
| if [[ ! "${version}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then | ||
| echo "::error::Version must look like 1.4.0 (no prerelease suffix for Play releases)." | ||
| exit 1 | ||
| fi | ||
| build="${INPUT_BUILD_NUMBER:-1}" | ||
| if [[ ! "${build}" =~ ^[0-9]+$ ]]; then | ||
| echo "::error::Build number must be a plain integer (got '${build}')." | ||
| exit 1 | ||
| fi | ||
| play_publish=true | ||
| tag="v${version}" | ||
| # Build 1 keeps the bare vX.Y.Z tag; later builds of the same | ||
| # version get their own tag so GitHub releases never collide. | ||
| if (( 10#$build == 1 )); then | ||
| tag="v${version}" | ||
| else | ||
| tag="v${version}+${build}" | ||
| fi | ||
| else | ||
| version="${GH_REF_NAME#v}" | ||
| if [[ ! "${version}" =~ ^[0-9]+\.[0-9]+\.[0-9]+([-+][0-9A-Za-z.-]+)?$ ]]; then | ||
| echo "::error::Tag must look like v1.2.3 (optionally with a -rc.1 style suffix)." | ||
| # -suffix marks a prerelease (no Play publish); +N is build | ||
| # metadata and still publishes. | ||
| if [[ ! "${version}" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.-]+)?(\+[0-9]+)?$ ]]; then | ||
| echo "::error::Tag must look like v1.2.3, v1.2.3+2, or v1.2.3-rc.1." | ||
| exit 1 | ||
| fi | ||
| if [[ "${version}" == *[-+]* ]]; then | ||
| if [[ "${version}" == *+* ]]; then | ||
| build="${version##*+}" | ||
| else | ||
| build=1 | ||
| fi |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Canonicalize build-number input across both release layers. Distinct values such as 2 and 002 currently map to the same versionCode, defeating the build-to-code uniqueness guarantee.
.github/workflows/release.yml#L103-L132: accept only canonical nonzero build metadata, e.g.+[1-9][0-9]*, and reject zero-padded dispatch values.fastlane/Fastfile#L78-L83: require the same canonical nonzero decimal format beforeto_i.
Proposed validation change
- if [[ ! "${build}" =~ ^[0-9]+$ ]]; then
+ if [[ ! "${build}" =~ ^[1-9][0-9]*$ ]]; then
- ^[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.-]+)?(\+[0-9]+)?$
+ ^[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.-]+)?(\+[1-9][0-9]*)?$
- unless build.match?(/\A\d+\z/)
+ unless build.match?(/\A[1-9]\d*\z/)📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| if [[ ! "${version}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then | |
| echo "::error::Version must look like 1.4.0 (no prerelease suffix for Play releases)." | |
| exit 1 | |
| fi | |
| build="${INPUT_BUILD_NUMBER:-1}" | |
| if [[ ! "${build}" =~ ^[0-9]+$ ]]; then | |
| echo "::error::Build number must be a plain integer (got '${build}')." | |
| exit 1 | |
| fi | |
| play_publish=true | |
| tag="v${version}" | |
| # Build 1 keeps the bare vX.Y.Z tag; later builds of the same | |
| # version get their own tag so GitHub releases never collide. | |
| if (( 10#$build == 1 )); then | |
| tag="v${version}" | |
| else | |
| tag="v${version}+${build}" | |
| fi | |
| else | |
| version="${GH_REF_NAME#v}" | |
| if [[ ! "${version}" =~ ^[0-9]+\.[0-9]+\.[0-9]+([-+][0-9A-Za-z.-]+)?$ ]]; then | |
| echo "::error::Tag must look like v1.2.3 (optionally with a -rc.1 style suffix)." | |
| # -suffix marks a prerelease (no Play publish); +N is build | |
| # metadata and still publishes. | |
| if [[ ! "${version}" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.-]+)?(\+[0-9]+)?$ ]]; then | |
| echo "::error::Tag must look like v1.2.3, v1.2.3+2, or v1.2.3-rc.1." | |
| exit 1 | |
| fi | |
| if [[ "${version}" == *[-+]* ]]; then | |
| if [[ "${version}" == *+* ]]; then | |
| build="${version##*+}" | |
| else | |
| build=1 | |
| fi | |
| if [[ ! "${version}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then | |
| echo "::error::Version must look like 1.4.0 (no prerelease suffix for Play releases)." | |
| exit 1 | |
| fi | |
| build="${INPUT_BUILD_NUMBER:-1}" | |
| if [[ ! "${build}" =~ ^[1-9][0-9]*$ ]]; then | |
| echo "::error::Build number must be a plain integer (got '${build}')." | |
| exit 1 | |
| fi | |
| play_publish=true | |
| # Build 1 keeps the bare vX.Y.Z tag; later builds of the same | |
| # version get their own tag so GitHub releases never collide. | |
| if (( 10#$build == 1 )); then | |
| tag="v${version}" | |
| else | |
| tag="v${version}+${build}" | |
| fi | |
| else | |
| version="${GH_REF_NAME#v}" | |
| # -suffix marks a prerelease (no Play publish); +N is build | |
| # metadata and still publishes. | |
| if [[ ! "${version}" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.-]+)?(\+[1-9][0-9]*)?$ ]]; then | |
| echo "::error::Tag must look like v1.2.3, v1.2.3+2, or v1.2.3-rc.1." | |
| exit 1 | |
| fi | |
| if [[ "${version}" == *+* ]]; then | |
| build="${version##*+}" | |
| else | |
| build=1 | |
| fi |
| if [[ ! "${version}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then | |
| echo "::error::Version must look like 1.4.0 (no prerelease suffix for Play releases)." | |
| exit 1 | |
| fi | |
| build="${INPUT_BUILD_NUMBER:-1}" | |
| if [[ ! "${build}" =~ ^[0-9]+$ ]]; then | |
| echo "::error::Build number must be a plain integer (got '${build}')." | |
| exit 1 | |
| fi | |
| play_publish=true | |
| tag="v${version}" | |
| # Build 1 keeps the bare vX.Y.Z tag; later builds of the same | |
| # version get their own tag so GitHub releases never collide. | |
| if (( 10#$build == 1 )); then | |
| tag="v${version}" | |
| else | |
| tag="v${version}+${build}" | |
| fi | |
| else | |
| version="${GH_REF_NAME#v}" | |
| if [[ ! "${version}" =~ ^[0-9]+\.[0-9]+\.[0-9]+([-+][0-9A-Za-z.-]+)?$ ]]; then | |
| echo "::error::Tag must look like v1.2.3 (optionally with a -rc.1 style suffix)." | |
| # -suffix marks a prerelease (no Play publish); +N is build | |
| # metadata and still publishes. | |
| if [[ ! "${version}" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.-]+)?(\+[0-9]+)?$ ]]; then | |
| echo "::error::Tag must look like v1.2.3, v1.2.3+2, or v1.2.3-rc.1." | |
| exit 1 | |
| fi | |
| if [[ "${version}" == *[-+]* ]]; then | |
| if [[ "${version}" == *+* ]]; then | |
| build="${version##*+}" | |
| else | |
| build=1 | |
| fi | |
| build = ENV.fetch("SILO_BUILD_NUMBER", "1").to_s.strip | |
| build = "1" if build.empty? | |
| unless build.match?(/\A[1-9]\d*\z/) | |
| UI.user_error!("SILO_BUILD_NUMBER must be a plain integer (got #{build.inspect}).") | |
| end | |
| build = build.to_i |
📍 Affects 2 files
.github/workflows/release.yml#L103-L132(this comment)fastlane/Fastfile#L78-L83
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In @.github/workflows/release.yml around lines 103 - 132, Canonicalize
build-number validation in both release layers: in .github/workflows/release.yml
lines 103-132, require dispatch and tag build metadata to match a nonzero,
non-padded decimal format such as [1-9][0-9]*; in fastlane/Fastfile lines 78-83,
apply the same validation before converting the build value with to_i. Preserve
rejection of zero, nonnumeric, and zero-padded values so distinct inputs cannot
share a versionCode.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3b0e86540a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| exit 1 | ||
| fi | ||
| build="${INPUT_BUILD_NUMBER:-1}" | ||
| if [[ ! "${build}" =~ ^[0-9]+$ ]]; then |
There was a problem hiding this comment.
Canonicalize build numbers before deriving release tags
Inputs such as build 2, 02, and 002 all pass this validation and produce the same numeric versionCode because the arithmetic uses 10#$build, but their preserved strings create distinct tags (v1.0.0+2, v1.0.0+02, etc.). Publishing either alternate spelling after the first therefore attempts to reuse both Play version codes and is rejected. Reject leading zeroes or canonicalize the build string before constructing tags; the tag-trigger regex has the same issue.
AGENTS.md reference: AGENTS.md:L24-L24
Useful? React with 👍 / 👎.
| shell: bash | ||
| env: | ||
| SILO_VERSION_NAME: ${{ needs.setup.outputs.version }} | ||
| SILO_VERSION_NAME: ${{ needs.setup.outputs.version_name }} |
There was a problem hiding this comment.
Preserve prerelease suffixes in sideload APK version names
For a prerelease tag such as v1.2.3-rc.1, setup deliberately retains the suffix in version while version_name is reduced to 1.2.3. Passing the reduced output to this APK job changes the Gradle versionName from the previous 1.2.3-rc.1 to 1.2.3, so the installed prerelease identifies itself as the stable release even though its artifact filename and GitHub release remain prerelease-labeled. The Play job needs the stripped value, but the sideload-only APK build should continue using the original version output.
Useful? React with 👍 / 👎.
| fi | ||
|
|
||
| version_part=$((10#$major * 10000 + 10#$minor * 100 + 10#$patch)) | ||
| version_code=$((epoch + version_part * 1000 + 10#$build)) |
There was a problem hiding this comment.
Keep rejecting the zero marketing version
A dispatch or tag for 0.0.0 now computes the positive base code 100000001, so the existing version_code <= 0 guard no longer rejects it and the workflow proceeds to publish it to Play. Before this change, 0.0.0 produced code zero and was explicitly rejected; the mirrored Fastfile still even describes 0.0.0 as non-releasable, but its positivity check is bypassed by the same epoch addition. Validate that at least one marketing-version component is nonzero before adding the epoch.
Useful? React with 👍 / 👎.
Problem
Play has no marketing-version/build-number split —
versionCodeis the only monotonic counter, and the pipeline derived it purely from the version string:So re-dispatching
1.0.0recomputed the same code and Play rejected it as a duplicate. Shipping a fix meant inventing a patch bump, unlike silo-apple where one marketing version carries many builds.Approach
versionNameis a free-form display string that may repeat — onlyversionCodemust strictly increase. So the build number goes into the versionCode while versionName stays put:Gradle still does
phone = base*2,TV = base*2+1— unchanged, no Gradle edit needed.The
100_000_000epoch lifts every code above the largest the old scheme could emit. v1.0.1 shipped2000002/2000003; the new minimum is220000002, so the switchover stays strictly increasing.Interface
build_numberinput (default1).+Nbuild metadata —v1.0.0+2.-rc.1still means prerelease and still skips the Play publish.vX.Y.Ztag; later builds getvX.Y.Z+Nso GitHub releases don't collide.SILO_VERSION_NAMEnow carries plainmajor.minor.patchvia a newversion_nameoutput — av1.0.0+2tag would otherwise fail the Fastfile's strict version regex.Bounds
major ≤ 94, minor/patch ≤ 99, build ≤ 999 — enforced in both the workflow and the Fastfile. At
94.99.99build 999 the base is exactly Gradle's1_049_999_999cap and the TV code is2_099_999_999, just under Play's2_100_000_000ceiling.Verification
Both implementations must agree or Play gets mismatched artifacts, so I tested them against each other rather than by inspection:
run:block and executed it against 17 cases (dispatch + tag, valid + invalid). All correct.resolve_release_versionunder Ruby 3.3 across the same inputs — identical base codes in every case, and both reject the same 6 invalid inputs.110000001and1049999999, rejects1050000000.An earlier draft used major ≤ 95; the bounds test caught that
95.99.99build 999 overflows Gradle's cap by 10,000,000. Corrected to 94.Note for the reviewer
This does not publish anything. The first release using it should be
1.0.0 build 1→ phone220000002, which is a large jump from the current2000002. That's intentional and one-way: versionCodes can never go back down.🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Documentation