Skip to content

Commit 2cf1339

Browse files
Titouan Thibaudtitooan
authored andcommitted
Get the version name from the release tag in the release workflow
1 parent 1793b0a commit 2cf1339

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

.github/workflows/release_apk.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,16 @@ jobs:
3131
# - name: Run unit tests
3232
# run: ./gradlew testDebugUnitTest
3333

34+
- name: Extract version name
35+
run: echo "VERSION_NAME=${GITHUB_REF_NAME#v}" >> $GITHUB_ENV
36+
3437
- name: Build Release APK
3538
env:
3639
KEYSTORE_FILE: ${{ github.workspace }}/keystore.jks
3740
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
3841
KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
3942
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
40-
run: ./gradlew assembleRelease
43+
run: ./gradlew assembleRelease -PversionName=${{ env.VERSION_NAME }} -PversionCode=${{ github.run_number }}
4144

4245
- name: Rename APK
4346
run: mv app/build/outputs/apk/release/app-release.apk app/build/outputs/apk/release/tryfox.apk

app/build.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ android {
1515
applicationId = "org.mozilla.tryfox"
1616
minSdk = 26
1717
targetSdk = 36
18-
versionCode = 1
19-
versionName = "1.0"
18+
versionCode = (findProperty("versionCode") as String?)?.toInt() ?: 1
19+
versionName = (findProperty("versionName") as String?) ?: "0.0.1"
2020

2121
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
2222
}

0 commit comments

Comments
 (0)