A one-of-a-kind resume builder that keeps your privacy in mind. Completely secure, customizable, portable, open-source and free forever. Try it out today!
TypeScript agent-skillsaidsh-pluginhacktoberfestjavascriptmcp-serverreactresume-builderself-hostedtypescript
fix(mobile): increment build numbers once per release run
Amruth Pillai01ea38cce6b6
diff --git a/.agents/docs/mobile-ci.md b/.agents/docs/mobile-ci.mdindex 396ded80b..f96f2f3d7 100644--- a/.agents/docs/mobile-ci.md+++ b/.agents/docs/mobile-ci.md@@ -8,7 +8,7 @@ existing Docker release workflow.Setup verified on **2026-10-21**: all eleven signing/upload secrets were copied fromexisting EAS credentials into repository Actions secrets; the existing `EXPO_TOKEN`-was retained. `MOBILE_BUILD_NUMBER_BASE` is **100**. Live store counters were iOS **6**+was retained. The initial `MOBILE_BUILD_NUMBER_BASE` was **100**. Live store counters were iOS **6**and Android **8**; workflow run 1, attempt 1 will allocate **100**. Environment`mobile-store` requires approval from `amruthpillai`, allows self-review, disallows adminbypass, and accepts only branch `main`. The workflow is manually dispatched after its@@ -53,21 +53,25 @@ Play App Signing retains its existing app-signing certificate. Do not replace`MOBILE_ANDROID_CERT_SHA256` with the upload-keystore fingerprint. Keep bundle/packageID `me.rxresu`, Apple team, keychain groups, and associated domains unchanged.-Set repository Actions variable `MOBILE_BUILD_NUMBER_BASE` to an integer **greater than-every build number/version code already allocated in EAS or uploaded to either store**.-Read current counters; do not use the historical 4/5 values in the handoff as live data.+Set repository Actions variable `MOBILE_BUILD_NUMBER_BASE` so the next workflow run+allocates a number **greater than every build number/version code already allocated+in EAS or uploaded to either store**. For next run number N and desired build B,+set the base to `B - (N - 1)`. Read current counters; do not use the historical 4/5+values in the handoff as live data.The workflow allocates both platforms' versions as:```text-MOBILE_BUILD_NUMBER_BASE + (GITHUB_RUN_NUMBER - 1) * 100 + (GITHUB_RUN_ATTEMPT - 1)+MOBILE_BUILD_NUMBER_BASE + (GITHUB_RUN_NUMBER - 1)```-The first run starts at the configured base: base 100 allocates 100 on attempt 1,-101 on attempt 2, and 200 on run 2's first attempt. This reserves 99 attempts per run-and fails before compilation on missing/invalid-configuration or Android's 2,100,000,000 limit. Never decrease the base or reset the-workflow counter. Rerunning an older run after a newer upload can produce an older-version; dispatch a fresh run instead. Stop EAS store builds after migration so two+Each new workflow run increments by one. Retries reuse the same build number;+if an upload already used that number, dispatch a fresh run instead of rebuilding+and uploading it again. The October 21 migration from the old 100-number stride+uses base **298**: run 3 already allocated 300, so run 4 allocates 301, then run 5+allocates 302. Change the base only while no release is running, and never reset+the workflow counter. Missing/invalid configuration and Android's 2,100,000,000+limit fail before compilation. Rerunning an older run after a newer upload can+produce an older version; dispatch a fresh run instead. Stop EAS store builds after migration so twosystems do not allocate competing versions. `eas.json` remains legacy configuration;its remote counters and auto-increment do not govern this workflow.diff --git a/tooling/mobile/release.test.ts b/tooling/mobile/release.test.tsindex 4a73afe5a..0be4cece4 100644--- a/tooling/mobile/release.test.ts+++ b/tooling/mobile/release.test.ts@@ -18,11 +18,12 @@ const android = {ANDROID_KEY_PASSWORD: "fixture",};-it("starts at the configured base and keeps versions unique across runs and retries", () => {+it("increments once per workflow run and reuses the number on retries", () => {expect(buildNumber(version)).toBe(100);- expect(buildNumber({ ...version, GITHUB_RUN_ATTEMPT: "2" })).toBe(101);- expect(buildNumber({ ...version, GITHUB_RUN_ATTEMPT: "99" })).toBe(198);- expect(buildNumber({ ...version, GITHUB_RUN_NUMBER: "2" })).toBe(200);+ expect(buildNumber({ ...version, GITHUB_RUN_ATTEMPT: "2" })).toBe(100);+ expect(buildNumber({ ...version, GITHUB_RUN_NUMBER: "2" })).toBe(101);+ expect(buildNumber({ ...version, GITHUB_RUN_NUMBER: "3" })).toBe(102);+ expect(buildNumber({ ...version, MOBILE_BUILD_NUMBER_BASE: "298", GITHUB_RUN_NUMBER: "4" })).toBe(301);expect(buildNumber({ ...version, MOBILE_BUILD_NUMBER_BASE: "2100000000" })).toBe(2_100_000_000);expect(validateRelease(android)).toBe(100);});@@ -34,10 +35,8 @@ it.each([{ MOBILE_BUILD_NUMBER_BASE: "1e3" },{ MOBILE_BUILD_NUMBER_BASE: "9007199254740992" },{ MOBILE_BUILD_NUMBER_BASE: "2100000001" },- { MOBILE_BUILD_NUMBER_BASE: "2099999901", GITHUB_RUN_NUMBER: "2" },+ { MOBILE_BUILD_NUMBER_BASE: "2100000000", GITHUB_RUN_NUMBER: "2" },{ GITHUB_RUN_NUMBER: "0" },- { GITHUB_RUN_ATTEMPT: "0" },- { GITHUB_RUN_ATTEMPT: "100" },])("rejects absent, ambiguous or overflowing version allocation: %j", (override) => {expect(() => buildNumber({ ...version, ...override })).toThrow();});diff --git a/tooling/mobile/release.ts b/tooling/mobile/release.tsindex 09d47474a..60646e3fd 100644--- a/tooling/mobile/release.ts+++ b/tooling/mobile/release.ts@@ -2,7 +2,7 @@ import { appendFileSync } from "node:fs";import { resolve } from "node:path";import { pathToFileURL } from "node:url";-// Reserve 99 attempts per workflow run; changing the offset later must never decrease store versions.+// One number per workflow run; retries reuse that run's number.export function buildNumber(env: NodeJS.ProcessEnv) {const integer = (name: string) => {const value = env[name];@@ -14,9 +14,8 @@ export function buildNumber(env: NodeJS.ProcessEnv) {const base = integer("MOBILE_BUILD_NUMBER_BASE");if (base < 1) throw new Error("MOBILE_BUILD_NUMBER_BASE must be positive");const run = integer("GITHUB_RUN_NUMBER");- const attempt = integer("GITHUB_RUN_ATTEMPT");- if (run < 1 || attempt < 1 || attempt > 99) throw new Error("Run must be positive; attempt must be 1–99");- const number = base + (run - 1) * 100 + (attempt - 1);+ if (run < 1) throw new Error("Run must be positive");+ const number = base + (run - 1);if (!Number.isSafeInteger(number) || number > 2_100_000_000) throw new Error("Android versionCode limit exceeded");return number;}