Skip to content

Commit

Permalink
Merge pull request #91 from futuredapp/feature/app-distribution
Browse files Browse the repository at this point in the history
Change enterprise publishing from AppCenter to Firebase App Distribution
  • Loading branch information
matejsemancik authored Sep 16, 2024
2 parents 45784cc + c6c00df commit aff565a
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 26 deletions.
41 changes: 15 additions & 26 deletions .github/workflows/android_enterprise_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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/[email protected]
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
Expand Down
3 changes: 3 additions & 0 deletions androidApp/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ 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)
}

kotlin {
Expand Down
4 changes: 4 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ 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
project-android-namespace = "app.futured.kmptemplate.android"
Expand Down Expand Up @@ -150,6 +152,8 @@ 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
conventions-lint = { id = "conventions-lint" }
Expand Down

0 comments on commit aff565a

Please sign in to comment.