From 9d767595798eb0ff076fe72dbd202299b8cb7403 Mon Sep 17 00:00:00 2001 From: "jan.mikulik" Date: Thu, 12 Sep 2024 11:41:17 +0200 Subject: [PATCH 1/3] Change enterprise publishing from AppCenter to Firebase App Distribution --- .../workflows/android_enterprise_release.yml | 41 +++++++------------ 1 file changed, 15 insertions(+), 26 deletions(-) diff --git a/.github/workflows/android_enterprise_release.yml b/.github/workflows/android_enterprise_release.yml index 47d416a9..a308265c 100644 --- a/.github/workflows/android_enterprise_release.yml +++ b/.github/workflows/android_enterprise_release.yml @@ -37,11 +37,10 @@ jobs: needs: detect-changes if: ${{ needs.detect-changes.outputs.androidFiles == 'true' }} env: - # TODO AppCenter application name, eg. "futured/Gastromapa" - APPCENTER_APP_NAME: futured/ApplicationName - # Add additional AppCenter user groups separated by semicolon, if applicable, eg. "Collaborators;Partners" - APPCENTER_GROUPS: Collaborators - EXCLUDE_APK_FILTER: .*unaligned.apk\|.*Test.*.apk + # TODO Verify app distribution groups + APP_DISTRIBUTION_GROUPS: futured-qa, devs + APP_DISTRIBUTION_ARTIFACT_TYPE: APK + FIREBASE_CREDENTIALS_FILE: firebase_credentials.json # TODO Platform-specific slack channel name for notifications, eg. "gmlh-android" SLACK_CHANNEL: project-slack-channel-name # TODO verify product flavor configuration @@ -64,33 +63,23 @@ jobs: java-version: '17' - name: Setup Gradle uses: gradle/gradle-build-action@v2 - - name: Run Lint check - shell: bash - # `lintRelease` covers androidApp module and all shared modules all at once. No need to call `lintEnterprise` and `lintRelease`. - run: ./gradlew --continue lintCheck lintRelease + - name: Prepare environment + run: | + echo "BUILD_NUMBER=$((GITHUB_RUN_NUMBER))" >> $GITHUB_ENV + echo '${{ secrets.APP_DISTRIBUTION_SERVICE_ACCOUNT }}' > $FIREBASE_CREDENTIALS_FILE - name: Run unit tests shell: bash # `testReleaseUnitTest` covers androidApp module and all shared modules all at once. No need to call `testEnterpriseUnitTest` and `testReleaseUnitTest`. run: ./gradlew --continue testReleaseUnitTest - - name: Assemble APK - shell: bash - run: ./gradlew assembleEnterprise -P buildkonfig.flavor=${{env.KMP_FLAVOR}} - - name: Find artifacts and mapping file + - name: Assemble and upload to Firebase App Distribution shell: bash run: | - echo ::set-output name=apk_file::$(find . -name "*.apk" | grep -v ${{env.EXCLUDE_APK_FILTER}}) - echo ::set-output name=aab_file::$(find . -name "*.aab") - echo ::set-output name=mapping_file::$(find . -name mapping.txt) - id: artifacts - - name: Publish to App Center - uses: wzieba/AppCenter-Github-Action@v1.3.2 - with: - appName: ${{env.APPCENTER_APP_NAME}} - token: ${{secrets.APPCENTER_API_TOKEN}} - group: ${{env.APPCENTER_GROUPS}} - file: ${{steps.artifacts.outputs.apk_file}} - releaseNotes: ${{ github.event.head_commit.message }} - notifyTesters: false + ./gradlew \ + assembleEnterprise -P buildkonfig.flavor=$KMP_FLAVOR \ + appDistributionUploadEnterprise \ + --serviceCredentialsFile="$FIREBASE_CREDENTIALS_FILE" \ + --artifactType="$APP_DISTRIBUTION_ARTIFACT_TYPE" \ + --groups="$APP_DISTRIBUTION_GROUPS" - name: Slack Notification if: failure() uses: homoluctus/slatify@master From 2c56829dd56b113be9d88cfaaa96fff34493b441 Mon Sep 17 00:00:00 2001 From: "jan.mikulik" Date: Thu, 12 Sep 2024 11:52:06 +0200 Subject: [PATCH 2/3] Add app distribution plugin --- androidApp/build.gradle.kts | 1 + gradle/libs.versions.toml | 2 ++ 2 files changed, 3 insertions(+) diff --git a/androidApp/build.gradle.kts b/androidApp/build.gradle.kts index 793ac047..b425c823 100644 --- a/androidApp/build.gradle.kts +++ b/androidApp/build.gradle.kts @@ -7,6 +7,7 @@ plugins { id(libs.plugins.kotlin.android.get().pluginId) id(libs.plugins.conventions.lint.get().pluginId) alias(libs.plugins.androidx.baselineprofile) + alias(libs.plugins.firebase.distribution) } kotlin { diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 1db078e4..6d7fc6c6 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -35,6 +35,7 @@ uiautomator = "2.3.0" benchmarkMacroJunit4 = "1.2.4" profileinstaller = "1.3.1" dokkaVersion = "1.9.20" +google-firebaseAppDistributionPlugin = "5.0.0" # Android Namespaces project-android-namespace = "app.futured.kmptemplate.android" @@ -150,6 +151,7 @@ moko-resources = { id = "dev.icerock.mobile.multiplatform-resources", version.re androidx-baselineprofile = { id = "androidx.baselineprofile", version.ref = "baselineProfile" } android-test = { id = "com.android.test", version.ref = "agp" } dokka = { id = "org.jetbrains.dokka", version.ref = "dokkaVersion" } +firebase-distribution = { id = "com.google.firebase.appdistribution", version.ref = "google-firebaseAppDistributionPlugin" } # Precompiled script plugins conventions-lint = { id = "conventions-lint" } From c6c00df28fc3caa5d9864553e449de438d287ee8 Mon Sep 17 00:00:00 2001 From: "jan.mikulik" Date: Fri, 13 Sep 2024 13:15:59 +0200 Subject: [PATCH 3/3] Add google services TODO --- androidApp/build.gradle.kts | 2 ++ gradle/libs.versions.toml | 2 ++ 2 files changed, 4 insertions(+) diff --git a/androidApp/build.gradle.kts b/androidApp/build.gradle.kts index b425c823..8948cb81 100644 --- a/androidApp/build.gradle.kts +++ b/androidApp/build.gradle.kts @@ -7,6 +7,8 @@ plugins { id(libs.plugins.kotlin.android.get().pluginId) id(libs.plugins.conventions.lint.get().pluginId) alias(libs.plugins.androidx.baselineprofile) + // TODO enable after providing google-services.json + //alias(libs.plugins.google.services) alias(libs.plugins.firebase.distribution) } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 6d7fc6c6..0734cdf8 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -35,6 +35,7 @@ uiautomator = "2.3.0" benchmarkMacroJunit4 = "1.2.4" profileinstaller = "1.3.1" dokkaVersion = "1.9.20" +google-servicesPlugin = "4.4.2" google-firebaseAppDistributionPlugin = "5.0.0" # Android Namespaces @@ -151,6 +152,7 @@ moko-resources = { id = "dev.icerock.mobile.multiplatform-resources", version.re androidx-baselineprofile = { id = "androidx.baselineprofile", version.ref = "baselineProfile" } android-test = { id = "com.android.test", version.ref = "agp" } dokka = { id = "org.jetbrains.dokka", version.ref = "dokkaVersion" } +google-services = { id = "com.google.gms.google-services", version.ref = "google-servicesPlugin" } firebase-distribution = { id = "com.google.firebase.appdistribution", version.ref = "google-firebaseAppDistributionPlugin" } # Precompiled script plugins