Skip to content

Commit 1123f5f

Browse files
evan-masseauclaude
andcommitted
ci(example): inject versionCode from github.run_number
Prevents collision with the versionCode=1 AAB that was uploaded manually to the Play Store internal track to prove package name ownership. Play rejects duplicate versionCodes per package, so the next CI upload would fail without this. github.run_number is monotonic per-workflow-per-repo, so successive CI publishes will always produce a strictly-increasing versionCode. The static `versionCode 1` in build.gradle stays as the local dev default; AGP's `android.injected.version.code` property wins when set. Known limitation (same as sibling TestFlight workflow): manual uploads that bump the versionCode outside of CI can get ahead of run_number, which would then fail as "not greater than previously uploaded build". Fix if/when it happens by re-triggering CI enough times to overtake, or add a large offset to run_number. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 1ae6097 commit 1123f5f

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

.github/workflows/publish-example-android.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,17 @@ jobs:
8686
# Signing is done inline via `-Pandroid.injected.signing.*` gradle properties so AGP
8787
# produces a properly v2/v3-signed AAB in a single pass — no separate re-sign step,
8888
# no risk of double-signing (Play rejects AABs with multiple signer certificates).
89+
# versionCode is overridden per-run via github.run_number so successive
90+
# CI uploads never collide on Play's strictly-increasing versionCode rule.
91+
# build.gradle's static `versionCode 1` stays as the local dev default;
92+
# AGP's `android.injected.version.code` property wins over it at build time.
93+
# Caveat: manual Play uploads that bump versionCode outside CI can get
94+
# ahead of github.run_number — if that happens, bump CI past the manual
95+
# number (e.g. by re-triggering the workflow N times, or adding an offset).
8996
- name: Assemble Release Bundle
9097
run: |
9198
cd example/android && ./gradlew :app:bundleRelease \
99+
-Pandroid.injected.version.code=${{ github.run_number }} \
92100
-Pandroid.injected.signing.store.file="${RUNNER_TEMP}/upload.jks" \
93101
-Pandroid.injected.signing.store.password="${KEY_STORE_PASSWORD}" \
94102
-Pandroid.injected.signing.key.alias="${ALIAS}" \

0 commit comments

Comments
 (0)