Skip to content

Use the run number as Android version code and iOS build number - #284

Open
ninovanhooff wants to merge 3 commits into
mainfrom
chore/android-version-code-from-run-number
Open

ninovanhooff wants to merge 3 commits into
mainfrom
chore/android-version-code-from-run-number

Conversation

@ninovanhooff

@ninovanhooff ninovanhooff commented Nov 3, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

The release workflows never overrode the version code, so every build had version code / build number 1 from gradle.properties, and couldn't be installed over the previous build or uploaded to TestFlight again.

  • Android: android-release.yml passed -Papp.versionCodeOverride and -Papp.versionNameOverride, but no build script reads those properties; androidApp and shared read appVersionCode / appVersionName.
  • iOS: ios-release.yml passed CURRENT_PROJECT_VERSION from printAppVersionMetadata, which just returned the gradle.properties value.

Changes

  • Added a prepare-release composite action (based on the one in widm-android). It sets ORG_GRADLE_PROJECT_appVersionCode to github.run_number plus an optional versioncode_offset. Gradle reads ORG_GRADLE_PROJECT_* environment variables as project properties, which take precedence over gradle.properties. So every later Gradle call in the job gets the same value without changing tracked files, including the embedAndSignAppleFrameworkForXcode call that Xcode starts.
  • Both release workflows run the action before "Resolve app version metadata". That covers:
    • the Android APK/AAB versionCode
    • the iOS CURRENT_PROJECT_VERSION
    • BuildKonfig's APP_VERSION_CODE on both platforms
    • artifact names, Firebase release notes and run summaries
  • Removed the unused -Papp.*Override flags from the Android workflow.
  • The iOS metadata step now logs the resolved version, so it's visible in the run log.

Testing

Ported from Q42/GoingsOn.CMP#53:

Not yet run on this repository.

🤖 Generated with Claude Code

Adds a prepare-release composite action that writes the run number (plus an
optional offset) to appVersionCode in gradle.properties. The workflow passed
-Papp.versionCodeOverride, which no build script read, so every build got
version code 1.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings November 3, 2026 16:00
@ninovanhooff
ninovanhooff requested a review from a team as a code owner November 3, 2026 16:00

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues are reported for the Android release-versioning changes.

No open issues 🎉

What changed in this PR

Fixes Android release versioning by writing the workflow run number to appVersionCode in gradle.properties, keeping release artifacts and shared build metadata consistent.

Changes:

  • Adds a reusable release-preparation action with an optional version-code offset.
  • Runs preparation before resolving Android version metadata.
  • Removes unused Gradle version override flags from build and Firebase upload commands.
File Description
.github/​workflows/​android-release.yml Prepares the version code before metadata resolution and removes unused overrides.
.github/​actions/​prepare-release/​action.yml Calculates, writes, and verifies the run-based version code.

Review effort: Balanced

ninovanhooff and others added 2 commits November 3, 2026 17:07
The prepare-release action now sets ORG_GRADLE_PROJECT_appVersionCode instead
of rewriting gradle.properties. It applies to every later Gradle call in the
job, without changing tracked files.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Runs the prepare-release action in the iOS release workflow, so
CURRENT_PROJECT_VERSION and BuildKonfig's APP_VERSION_CODE use the run number
instead of the version code 1 from gradle.properties.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ninovanhooff ninovanhooff changed the title Use the run number as Android version code Use the run number as Android version code and iOS build number Nov 3, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have a repository with reusable Actions here: https://github.com/Q42/actions
If this is a GitHub Action that we want to use for every project, it might make sense to put it there, so we can update it in a single place and not have the code duplicated in every project repo.

@ninovanhooff ninovanhooff Nov 4, 2026 •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So your suggestion is to create an action there called q42/gradle-version-number and update the current PR to use it in the prepare-release action, right? I think I like that idea

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants