Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change enterprise publishing from AppCenter to Firebase App Distribution #21

Merged
merged 3 commits into from
Sep 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 15 additions & 22 deletions .github/workflows/enterprise.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,10 @@ jobs:
name: Enterprise build
runs-on: [ubuntu-latest]
env:
# TODO AppCenter application name, eg. "futured/Gastromapa"
APPCENTER_APP_NAME: futured/app-name
# 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
steps:
Expand All @@ -25,28 +24,22 @@ jobs:
with:
distribution: 'zulu'
java-version: '17'
- name: Run check and Assemble APK
shell: bash
run: ./gradlew lintCheck assembleDevEnterprise
- 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
run: ./gradlew --continue testDevEnterpriseUnitTest
- 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 \
assembleDevEnterprise \
appDistributionUploadDevEnterprise \
--serviceCredentialsFile="$FIREBASE_CREDENTIALS_FILE" \
--artifactType="$APP_DISTRIBUTION_ARTIFACT_TYPE" \
--groups="$APP_DISTRIBUTION_GROUPS"
- name: Slack Notification
if: failure()
uses: homoluctus/slatify@master
Expand Down
50 changes: 30 additions & 20 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,44 +9,54 @@ jobs:
name: Release build
runs-on: [ubuntu-latest]
env:
# TODO AppCenter application name, eg. "futured/Gastromapa"
APPCENTER_APP_NAME: futured/app-name
APPCENTER_GROUPS: Release
EXCLUDE_APK_FILTER: .*unaligned.apk\|.*Test.*.apk
EXCLUDE_AAB_FILTER: .*intermediate
# TODO Platform-specific slack channel name for notifications, eg. "gmlh-android"
SLACK_CHANNEL: project-slack-channel-name
VERSION_NAME: ${{ github.event.release.tag_name }}
steps:
- uses: actions/checkout@v2
- name: Set build number
run: echo "BUILD_NUMBER=$((GITHUB_RUN_NUMBER))" >> $GITHUB_ENV
- name: Checkout
uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: '3.0'
- name: Set up JDK
uses: actions/setup-java@v1
- name: Setup Java
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '17'
- name: Run check and Assemble APK
shell: bash
run: ./gradlew lintCheck assembleProdRelease
- name: Run unit tests
shell: bash
run: ./gradlew --continue testDevEnterpriseUnitTest
- name: Generate app bundle
shell: bash
env:
# TODO Set up `RELEASE_KEYSTORE_PASSWORD` secret for this GitHub repository
# TODO Set up `RELEASE_KEY_PASSWORD` secret for this GitHub repository
# TODO Set up `RELEASE_KEY_ALIAS` secret for this GitHub repository
RELEASE_KEYSTORE_PASS: ${{ secrets.RELEASE_KEYSTORE_PASSWORD }}
RELEASE_KEY_PASS: ${{ secrets.RELEASE_KEY_PASSWORD }}
RELEASE_KEY_ALIAS: ${{ secrets.RELEASE_KEY_ALIAS }}
run: ./gradlew bundleProdRelease
- name: Find artifacts and mapping file
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=aab_file::$(find . -name "*.aab" | grep -v ${{env.EXCLUDE_AAB_FILTER}})
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
- name: Upload Android Release to Play Store
uses: r0adkll/upload-google-play@v1
with:
appName: ${{env.APPCENTER_APP_NAME}}
token: ${{secrets.APPCENTER_API_TOKEN}}
group: ${{env.APPCENTER_GROUPS}}
file: ${{steps.artifacts.outputs.apk_file}}
releaseNotes: ${{ github.event.release.body }}
notifyTesters: false
# TODO Set up `GOOGLE_PLAY_PUBLISH_SERVICE_ACCOUNT` as plaintext JSON for this GitHub repository
serviceAccountJsonPlainText: ${{ secrets.GOOGLE_PLAY_PUBLISH_SERVICE_ACCOUNT }}
# TODO This has to be applicationId
packageName: app.futured.androidprojecttemplate
releaseFiles: ${{ steps.artifacts.outputs.aab_file }}
track: internal
status: draft
whatsNewDirectory: whatsnew
mappingFile: ${{ steps.artifacts.outputs.mapping_file }}
- name: Slack Notification
if: failure()
uses: homoluctus/slatify@master
Expand Down
3 changes: 3 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ plugins {
kotlin("kapt")
kotlin("plugin.serialization") version Versions.kotlin
id("dagger.hilt.android.plugin")
// TODO enable after providing google-services.json
//id("com.google.gms.google-services")
id("com.google.firebase.appdistribution")
}

android.apply {
Expand Down
2 changes: 2 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ buildscript {
classpath(Dependencies.gradlePlugin)
classpath(kotlin(Dependencies.Kotlin.gradlePlugin, Versions.kotlin))
classpath(Dependencies.hiltPlugin)
classpath(Dependencies.googleServices)
classpath(Dependencies.firebaseAppDistribution)
}
}

Expand Down
2 changes: 2 additions & 0 deletions buildSrc/src/main/kotlin/Dependencies.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
object Dependencies {
const val gradlePlugin = "com.android.tools.build:gradle:${Versions.androidGradlePlugin}"
const val hiltPlugin = "com.google.dagger:hilt-android-gradle-plugin:${Versions.hilt}"
const val googleServices = "com.google.gms:google-services:${Versions.googleServices}"
const val firebaseAppDistribution = "com.google.firebase:firebase-appdistribution-gradle:${Versions.firebaseAppDistribution}"

object Plugins {
const val detekt = "io.gitlab.arturbosch.detekt"
Expand Down
4 changes: 2 additions & 2 deletions buildSrc/src/main/kotlin/ProjectSettings.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ object ProjectSettings {
const val compileSdkVersion = 34
const val targetSdk = 34
const val minSdk = 21
const val versionName = "1.0.0"
val versionCode = System.getenv("GITHUB_RUN_NUMBER")?.toInt() ?: 1
val versionName = System.getenv("VERSION_NAME") ?: "1.0.0"
val versionCode = System.getenv("BUILD_NUMBER")?.toInt() ?: 1

object Flavor {
const val DIMENSION = "api"
Expand Down
6 changes: 6 additions & 0 deletions buildSrc/src/main/kotlin/Versions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ object Versions {
// gradle
const val androidGradlePlugin = "8.4.0"

// google services
const val googleServices = "4.4.2"

// plugins
const val detekt = "1.23.6"
const val ktlintGradle = "12.1.1"
Expand Down Expand Up @@ -33,6 +36,9 @@ object Versions {
const val navigation = "2.8.0-alpha08"
const val hiltNavigation = "1.2.0"

// firebase
const val firebaseAppDistribution = "5.0.0"

// networking
const val okhttp = "4.12.0"
const val retrofit = "2.9.0"
Expand Down
Loading