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()