From c965746f8f09631e16ca196bfcf733dddfdda954 Mon Sep 17 00:00:00 2001 From: Kurdistan Tech Ministry Date: Tue, 10 Mar 2026 02:18:55 +0300 Subject: [PATCH] fix: use commit-count based versionCode to prevent downgrade on Firebase CI_BUILD_ID was using github.run_number which is per-workflow, causing different workflows to produce different versionCodes (144 vs 9). Now computed from git commit count + offset, consistent across all workflows. Also added bundle task to local auto-increment. --- .github/workflows/android_build.yml | 12 +++++++++--- .gitignore | 2 -- scripts/versions.gradle | 2 +- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/.github/workflows/android_build.yml b/.github/workflows/android_build.yml index 233eb6b..a276c0d 100644 --- a/.github/workflows/android_build.yml +++ b/.github/workflows/android_build.yml @@ -130,9 +130,7 @@ env: POLKASSEMBLY_SUMMARY_API_KEY: ${{ secrets.POLKASSEMBLY_SUMMARY_API_KEY }} - CI_BUILD_ID: ${{ github.run_number }} - -concurrency: +concurrency: group: ${{ github.workflow }}-${{ github.ref }}-${{inputs.upload-name}} cancel-in-progress: true @@ -146,6 +144,14 @@ jobs: uses: actions/checkout@v4 with: ref: ${{ inputs.branch }} + fetch-depth: 0 + + - name: Compute version code from commit count + run: | + COMMIT_COUNT=$(git rev-list --count HEAD) + VERSION_CODE=$((COMMIT_COUNT + 100)) + echo "CI_BUILD_ID=$VERSION_CODE" >> $GITHUB_ENV + echo "Version code: $VERSION_CODE (commits: $COMMIT_COUNT + offset 100)" - name: 📂 Set up DEV Google Services uses: davidSchuppa/base64Secret-toFile-action@v3 diff --git a/.gitignore b/.gitignore index 524e7b5..8227c7e 100644 --- a/.gitignore +++ b/.gitignore @@ -29,6 +29,4 @@ app/*.apk google-services.json **/google-services.json -# Version properties -version.properties .kotlin/ diff --git a/scripts/versions.gradle b/scripts/versions.gradle index 0b9a2d7..a2e0ac8 100644 --- a/scripts/versions.gradle +++ b/scripts/versions.gradle @@ -25,7 +25,7 @@ def computeVersionCode() { return Integer.valueOf(System.env.CI_BUILD_ID) } // Local build - auto increment - if (gradle.startParameter.taskNames.any { it.contains('assemble') || it.contains('install') }) { + if (gradle.startParameter.taskNames.any { it.contains('assemble') || it.contains('install') || it.contains('bundle') }) { return incrementVersionCode() } return getVersionCodeFromFile()