diff --git a/.github/workflows/maestro.yml b/.github/workflows/maestro.yml index 01783a1eb6..d3274d0b14 100644 --- a/.github/workflows/maestro.yml +++ b/.github/workflows/maestro.yml @@ -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 }} diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 956eebe71d..c893459f04 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -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 }} diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 6a28adecf1..79d6af8307 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -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" diff --git a/plugins/src/main/kotlin/Versions.kt b/plugins/src/main/kotlin/Versions.kt index a3dfa86de9..37ffeacfa7 100644 --- a/plugins/src/main/kotlin/Versions.kt +++ b/plugins/src/main/kotlin/Versions.kt @@ -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