diff options
| author | Peter Stone <thepeterstone@gmail.com> | 2026-05-05 13:18:01 -1000 |
|---|---|---|
| committer | Peter Stone <thepeterstone@gmail.com> | 2026-05-05 13:18:01 -1000 |
| commit | 39b48e53cd5eb534037842dc5f0acdc1fed40130 (patch) | |
| tree | 21650a09a31c195aa999719eec6bf7ad42a29735 | |
| parent | 2123351fc1d1c529046c5179171e4d442ca20f55 (diff) | |
feat: auto-increment build version with commit summary
versionCode = github.run_number (increments each CI run)
versionName = "1.0.<run> (<short-sha> <commit subject>)"
e.g. "1.0.47 (2123351 fix: keep bottom nav visible when panning)"
Local builds show "1.0-local (1)" as fallback.
Firebase release notes also show the version string.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
| -rw-r--r-- | .github/workflows/android.yml | 10 | ||||
| -rw-r--r-- | android-app/app/build.gradle | 4 |
2 files changed, 11 insertions, 3 deletions
diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index e99bf7d..b303eb6 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -23,8 +23,15 @@ jobs: - name: Grant execute permission for gradlew run: chmod +x android-app/gradlew + - name: Compute version + run: | + COMMIT_SHORT=$(git rev-parse --short HEAD) + COMMIT_MSG=$(git log -1 --pretty=format:'%s' | cut -c1-60) + echo "BUILD_VERSION_CODE=${{ github.run_number }}" >> $GITHUB_ENV + echo "BUILD_VERSION_NAME=1.0.${{ github.run_number }} (${COMMIT_SHORT} ${COMMIT_MSG})" >> $GITHUB_ENV + - name: Build with Gradle - run: ./gradlew assembleDebug + run: ./gradlew assembleDebug -PbuildVersionCode="$BUILD_VERSION_CODE" -PbuildVersionName="$BUILD_VERSION_NAME" working-directory: android-app - name: upload artifact to Firebase App Distribution @@ -34,6 +41,7 @@ jobs: appId: ${{secrets.FIREBASE_APP_ID}} serviceCredentialsFileContent: ${{ secrets.CREDENTIAL_FILE_CONTENT }} groups: testers + releaseNotes: "${{ env.BUILD_VERSION_NAME }}" file: android-app/app/build/outputs/apk/debug/app-debug.apk - name: Notify claudomator diff --git a/android-app/app/build.gradle b/android-app/app/build.gradle index f6ad111..554b513 100644 --- a/android-app/app/build.gradle +++ b/android-app/app/build.gradle @@ -15,8 +15,8 @@ android { applicationId "org.terst.nav" minSdk 24 targetSdk 34 - versionCode 1 - versionName "1.0" + versionCode project.hasProperty('buildVersionCode') ? project.buildVersionCode.toInteger() : 1 + versionName project.hasProperty('buildVersionName') ? project.buildVersionName : "1.0-local" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } |
