-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add android-cloud-release-firebaseAppDistribution.yml workflow
- Loading branch information
1 parent
52bbfb2
commit a7e8faf
Showing
2 changed files
with
135 additions
and
15 deletions.
There are no files selected for viewing
119 changes: 119 additions & 0 deletions
119
.github/workflows/android-cloud-release-firebaseAppDistribution.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
name: Android Release to Firebase App Distribution | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
TIMEOUT_MINUTES: | ||
description: "Job timeout in minutes" | ||
required: false | ||
type: number | ||
default: 30 | ||
VERSION_NAME: | ||
description: "Version name" | ||
required: false | ||
type: string | ||
default: '1.X.X-snapshot' | ||
BUILD_NUMBER_OFFSET: | ||
description: "Build number offset. This number will be added to GITHUB_RUN_NUMBER and can be used to make corrections to build numbers." | ||
required: false | ||
type: number | ||
default: 0 | ||
KMP_FLAVOR: | ||
description: "KMP Build flavor. This is optional and only required by KMP projects and can be ignored on pure Android projects". | ||
required: false | ||
type: string | ||
default: 'test' | ||
APP_DISTRIBUTION_GROUPS: | ||
description: "Comma-separated list of app distribution group IDs" | ||
required: true | ||
type: string | ||
TEST_GRADLE_TASKS: | ||
description: "A Gradle task(s) for executing unit tests, for example `testReleaseUnitTest` or `testDevEnterpriseUnitTest`" | ||
required: true | ||
type: string | ||
BUNDLE_GRADLE_TASK: | ||
description: "A Gradle task for assembling app bundle, for example `bundleEnterprise`" | ||
required: true | ||
type: string | ||
UPLOAD_GRADLE_TASK: | ||
description: "A Gradle task for uploading APK, for example `appDistributionUploadEnterprise`" | ||
required: true | ||
type: string | ||
SIGNING_KEYSTORE_PATH: | ||
description: "Path to keystore for signing of universal APK. Example: `keystore/debug.jks' or 'androidApp/signing/debug.keystore'." | ||
required: true | ||
type: string | ||
SIGNING_KEYSTORE_PASSWORD: | ||
description: "Password to provided keystore" | ||
required: true | ||
type: string | ||
SIGNING_KEY_ALIAS: | ||
description: "Alias of the signing key in the provided keystore" | ||
required: true | ||
type: string | ||
SIGNING_KEY_PASSWORD: | ||
description: "Password to the key in the provided keystore" | ||
required: true | ||
type: string | ||
secrets: | ||
APP_DISTRIBUTION_SERVICE_ACCOUNT: | ||
required: true | ||
description: "Firebase App Distribution Service Account JSON key" | ||
|
||
jobs: | ||
build: | ||
name: Enterprise Build | ||
runs-on: [ ubuntu-latest ] | ||
timeout-minutes: ${{ inputs.TIMEOUT_MINUTES }} | ||
env: | ||
FIREBASE_CREDENTIALS_FILE: firebase_credentials.json | ||
BUNDLETOOL_URL: https://github.com/google/bundletool/releases/download/1.17.2/bundletool-all-1.17.2.jar | ||
EXCLUDE_AAB_FILTER: .*intermediate | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Setup Java | ||
uses: actions/setup-java@v4 | ||
with: | ||
distribution: 'zulu' | ||
java-version: '17' | ||
- name: Setup Gradle | ||
uses: gradle/actions/setup-gradle@v4 | ||
- name: Prepare Environment | ||
run: | | ||
echo "BUILD_NUMBER=$((GITHUB_RUN_NUMBER + ${{ inputs.BUILD_NUMBER_OFFSET}} ))" >> $GITHUB_ENV | ||
echo "VERSION_NAME=${{ inputs.VERSION_NAME }}" >> $GITHUB_ENV | ||
echo "KMP_FLAVOR=${{ inputs.KMP_FLAVOR }}" >> $GITHUB_ENV | ||
- name: Run Unit tests | ||
shell: bash | ||
run: ./gradlew --continue ${{ inputs.TEST_GRADLE_TASKS }} | ||
- name: Generate Artifacts (AAB and APK) | ||
id: artifacts | ||
shell: bash | ||
run: | | ||
./gradlew ${{ inputs.BUNDLE_GRADLE_TASK }} -P buildkonfig.flavor=$KMP_FLAVOR | ||
BUNDLE_FILE=$(find . -name '*.aab' | grep -v '.*intermediate') | ||
wget -O bundletool.jar ${{ env.BUNDLETOOL_URL }} | ||
java -jar bundletool.jar build-apks \ | ||
--bundle $BUNDLE_FILE \ | ||
--output universal.apks \ | ||
--mode universal \ | ||
--ks ${{ inputs.SIGNING_KEYSTORE_PATH }} | ||
--ks-pass pass:${{ inputs.SIGNING_KEYSTORE_PASSWORD }} \ | ||
--ks-key-alias ${{ inputs.SIGNING_KEY_ALIAS }} | ||
--key-pass pass:${{ inputs.SIGNING_KEY_PASSWORD }} | ||
unzip universal.apks -d universal_apk | ||
UNIVERSAL_APK_FILE=$(find universal_apk/ -name '*.apk') | ||
echo "bundle_file=$BUNDLE_FILE" >> $GITHUB_OUTPUT | ||
echo "universal_apk_file=$UNIVERSAL_APK_FILE" >> $GITHUB_OUTPUT | ||
- name: Upload to Firebase App Distribution | ||
shell: bash | ||
run: | | ||
echo '${{ secrets.APP_DISTRIBUTION_SERVICE_ACCOUNT }}' > $FIREBASE_CREDENTIALS_FILE | ||
./gradlew ${{ inputs.UPLOAD_GRADLE_TASK }} \ | ||
--serviceCredentialsFile="$FIREBASE_CREDENTIALS_FILE" \ | ||
--groups="${{ inputs.APP_DISTRIBUTION_GROUPS }}" | ||
--artifactType="APK" \ | ||
--artifactPath="${{ steps.artifacts.outputs.universal_apk_file }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters