[MS-1459] Enhance version code computation and validation#1703
[MS-1459] Enhance version code computation and validation#1703meladRaouf wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
Updates the reusable APK build workflow to validate the provided version-name input and compute a new Android VERSION_CODE derived from the semantic version components, so CI builds can embed consistent version metadata into Gradle build properties.
Changes:
- Replaces the prior base/run-number version-code scheme with a semantic-version-based computation.
- Adds validation for
VERSION_NAMEformat and bounds (year/minor/patch). - Centralizes computation of
VERSION_CODEandFILE_NAMEinto a single step.
e759a2d to
4f318d3
Compare
4f318d3 to
e87b8ea
Compare
ffb278b to
8750e98
Compare
8750e98 to
27bac3c
Compare
luhmirin-s
left a comment
There was a problem hiding this comment.
Is there any way to "unit test" the computation? It looks correct, but I would feel safer to approve it if there were tests :D
BurningAXE
left a comment
There was a problem hiding this comment.
Looks good! Smart to trim the pipeline runs to 3 digits!
I don't foresee any issues with this approach and it should be generous enough for lots of minor and patch releases.
If we can unit test it, maybe we can put it on a test branch and feed it different values to see what it spits out. |
c64de94 to
252505b
Compare
…dd unit test for it
252505b to
bd82fc9
Compare
@luhmirin-s @BurningAXE I asked copilot to run tests for the version code generation
|
|



This PR changes APK versionCode generation to be derived from the app's versionName instead of CI build order. The new scheme encodes the release year, minor version, patch version, and build sequence into a stable numeric versionCode.
This fixes a downgrade issue that occurred when creating hotfix builds for older releases, where newly generated APKs could end up with a lower versionCode than versions already published on Google Play.
Example
This ensures version codes remain predictable and monotonically increasing across rebuilds and hotfixes.