Merge pull request #941 from vector-im/feature/bma/versionCode

Version code
This commit is contained in:
Benoit Marty
2023-07-21 12:18:30 +02:00
committed by GitHub
4 changed files with 40 additions and 12 deletions

View File

@@ -49,7 +49,9 @@ jobs:
- uses: mobile-dev-inc/action-maestro-cloud@v1.4.1
with:
api-key: ${{ secrets.MAESTRO_CLOUD_API_KEY }}
app-file: app/build/outputs/apk/debug/app-universal-debug.apk
# Doc says (https://github.com/mobile-dev-inc/action-maestro-cloud#android):
# app-file should point to an x86 compatible APK file, so upload the x86_64 one (much smaller than the universal APK).
app-file: app/build/outputs/apk/debug/app-x86_64-debug.apk
env: |
USERNAME=maestroelement
PASSWORD=${{ secrets.MATRIX_MAESTRO_ACCOUNT_PASSWORD }}

View File

@@ -1,4 +1,4 @@
name: Build and release nightly APK
name: Build and release nightly application
on:
workflow_dispatch:
@@ -12,7 +12,7 @@ env:
jobs:
nightly:
name: Build and publish nightly APK to Firebase
name: Build and publish nightly bundle to Firebase
runs-on: ubuntu-latest
if: ${{ github.repository == 'vector-im/element-x-android' }}
steps:
@@ -31,9 +31,9 @@ jobs:
sed 's/CHANGES\.md/CHANGES_NIGHTLY\.md/' towncrier.toml.bak > towncrier.toml
rm towncrier.toml.bak
yes n | towncrier build --version nightly
- name: Build and upload Nightly APK
- name: Build and upload Nightly bundle
run: |
./gradlew assembleNightly appDistributionUploadNightly $CI_GRADLE_ARG_PROPERTIES
./gradlew bundleNightly appDistributionUploadNightly $CI_GRADLE_ARG_PROPERTIES
env:
ELEMENT_ANDROID_MAPTILER_API_KEY: ${{ secrets.MAPTILER_KEY }}
ELEMENT_ANDROID_MAPTILER_LIGHT_MAP_ID: ${{ secrets.MAPTILER_LIGHT_MAP_ID }}
@@ -44,7 +44,9 @@ jobs:
FIREBASE_TOKEN: ${{ secrets.ELEMENT_ANDROID_NIGHTLY_FIREBASE_TOKEN }}
- name: Additionally upload Nightly APK to browserstack for testing
continue-on-error: true # don't block anything by this upload failing (for now)
run: curl -u "$BROWSERSTACK_USERNAME:$BROWSERSTACK_PASSWORD" -X POST "https://api-cloud.browserstack.com/app-automate/upload" -F "file=@app/build/outputs/apk/nightly/app-universal-nightly.apk" -F "custom_id=element-x-android-nightly"
run: |
./gradlew assembleNightly $CI_GRADLE_ARG_PROPERTIES
curl -u "$BROWSERSTACK_USERNAME:$BROWSERSTACK_PASSWORD" -X POST "https://api-cloud.browserstack.com/app-automate/upload" -F "file=@app/build/outputs/apk/nightly/app-universal-nightly.apk" -F "custom_id=element-x-android-nightly"
env:
BROWSERSTACK_USERNAME: ${{ secrets.ELEMENT_ANDROID_BROWSERSTACK_USERNAME }}
BROWSERSTACK_PASSWORD: ${{ secrets.ELEMENT_ANDROID_BROWSERSTACK_ACCESS_KEY }}

View File

@@ -124,11 +124,8 @@ android {
}
firebaseAppDistribution {
artifactType = "APK"
// We upload the universal APK to fix this error:
// "App Distribution found more than 1 output file for this variant.
// Please contact firebase-support@google.com for help using APK splits with App Distribution."
artifactPath = "$rootDir/app/build/outputs/apk/nightly/app-universal-nightly.apk"
artifactType = "AAB"
artifactPath = "$rootDir/app/build/outputs/bundle/nightly/app-nightly.aab"
// This file will be generated by the GitHub action
releaseNotesFile = "CHANGES_NIGHTLY.md"
groups = "external-testers"

View File

@@ -17,6 +17,33 @@
import org.gradle.api.JavaVersion
import org.gradle.jvm.toolchain.JavaLanguageVersion
/**
* Version codes are quite sensitive, because there is a mix between bundle and APKs, and we have to take into
* account the future upgrade of Element Android.
* Max versionCode allowed by the PlayStore (for information):
* 2_100_000_000
* Current version code of EAx on the PlayStore, for the first uploaded beta (we cannot go below):
* ----1_001_000
* Current version code of EAx on the nightly:
* ----1_001_000
* Current version of Element Android (at some point EAx will replace this app) (v1.6.3)
* ----40_106_03a where a stands for the architecture: 1, 2, 3, 4 and 0 for the universal APK
* Current version of EAx distributed with Firebase app distribution:
* ----1_002_000
* Latest version of EAx distributed with Firebase app distribution (downgrading, so that's a problem)
* -------10_200
* Version when running the current debug build
* -------10_200
*
* So adding 4_000_000 to the current version Code computed here should be fine, we will have:
* Release version:
* ---40_001_020
* Nightly version:
* ---40_001_020
* Debug version:
* ---40_010_200
*/
// Note: 2 digits max for each value
private const val versionMajor = 0
private const val versionMinor = 1
@@ -27,7 +54,7 @@ private const val versionMinor = 1
private const val versionPatch = 2
object Versions {
val versionCode = (versionMajor * 1_00_00 + versionMinor * 1_00 + versionPatch) * 10
val versionCode = 4_000_000 + versionMajor * 1_00_00 + versionMinor * 1_00 + versionPatch
val versionName = "$versionMajor.$versionMinor.$versionPatch"
const val compileSdk = 33
const val targetSdk = 33