Skip to content

Commit

Permalink
Add android-cloud-release-firebaseAppDistribution.yml workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
matejsemancik committed Dec 20, 2024
1 parent 52bbfb2 commit a7e8faf
Show file tree
Hide file tree
Showing 2 changed files with 135 additions and 15 deletions.
119 changes: 119 additions & 0 deletions .github/workflows/android-cloud-release-firebaseAppDistribution.yml
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 }}"
31 changes: 16 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,22 @@ All the available reusable workflows are listed in the following table.
### Available workflows
| Platform | Runner | Action | File | Description |
|:---------------|:------------|:--------------------|:-----------------------------------------------------------------------------------------|:-------------------------------------------------------------------------------------|
| Universal | Cloud | Backup | [`universal-cloud-backup`](.github/workflows/universal-cloud-backup.yml) | Backups currently checked out ref to a remote repository. |
| Universal | Self-hosted | Backup | [`universal-selfhosted-backup`](.github/workflows/universal-selfhosted-backup.yml) | Backups currently checked out ref to a remote repository. |
| Universal | Cloud | Detect Changes | [`universal-cloud-detect-changes`](.github/workflows/universal-cloud-detect-changes.yml) | Detects changed sources in KMP projects for conditional job execution. |
| iOS | Self-hosted | Test | [`ios-selfhosted-test`](.github/workflows/ios-selfhosted-test.yml) | Lints and tests the PR. |
| iOS | Self-hosted | Build | [`ios-selfhosted-build`](.github/workflows/ios-selfhosted-build.yml) | Creates enterprise release build and submits the build to Futured App Store Connect. |
| iOS | Self-hosted | Release | [`ios-selfhosted-release`](.github/workflows/ios-selfhosted-release.yml) | Creates release build and submits it to App Store Connect. |
| iOS | Cloud | Test | [`ios-cloud-test`](.github/workflows/ios-cloud-test.yml) | Lints and tests the PR. |
| iOS | Cloud | Build | [`ios-cloud-build`](.github/workflows/ios-cloud-build.yml) | Creates enterprise release build and submits the build to App Center. |
| iOS | Cloud | Release | [`ios-cloud-release`](.github/workflows/ios-cloud-release.yml) | Creates release build and submits it to App Store Connect. |
| iOS (KMP) | Self-hosted | Test | [`ios-kmp-selfhosted-test`](.github/workflows/ios-kmp-selfhosted-test.yml) | Lints and tests the PR. |
| iOS (KMP) | Self-hosted | Build | [`ios-kmp-selfhosted-build`](.github/workflows/ios-kmp-selfhosted-build.yml) | Creates enterprise release build and submits the build to Futured App Store Connect. |
| iOS (KMP) | Self-hosted | Release | [`ios-kmp-selfhosted-release`](.github/workflows/ios-kmp-selfhosted-release.yml) | Creates release build and submits it to App Store Connect. |
| Android (+KMP) | Cloud | Tests & Lint checks | [`android-cloud-check`](.github/workflows/android-cloud-check.yml) | Runs unit tests and lint checks on pull request. |
| Platform | Runner | Action | File | Description |
|:---------------|:------------|:--------------------|:-----------------------------------------------------------------------------------------------------------------------|:-------------------------------------------------------------------------------------|
| Universal | Cloud | Backup | [`universal-cloud-backup`](.github/workflows/universal-cloud-backup.yml) | Backups currently checked out ref to a remote repository. |
| Universal | Self-hosted | Backup | [`universal-selfhosted-backup`](.github/workflows/universal-selfhosted-backup.yml) | Backups currently checked out ref to a remote repository. |
| Universal | Cloud | Detect Changes | [`universal-cloud-detect-changes`](.github/workflows/universal-cloud-detect-changes.yml) | Detects changed sources in KMP projects for conditional job execution. |
| iOS | Self-hosted | Test | [`ios-selfhosted-test`](.github/workflows/ios-selfhosted-test.yml) | Lints and tests the PR. |
| iOS | Self-hosted | Build | [`ios-selfhosted-build`](.github/workflows/ios-selfhosted-build.yml) | Creates enterprise release build and submits the build to Futured App Store Connect. |
| iOS | Self-hosted | Release | [`ios-selfhosted-release`](.github/workflows/ios-selfhosted-release.yml) | Creates release build and submits it to App Store Connect. |
| iOS | Cloud | Test | [`ios-cloud-test`](.github/workflows/ios-cloud-test.yml) | Lints and tests the PR. |
| iOS | Cloud | Build | [`ios-cloud-build`](.github/workflows/ios-cloud-build.yml) | Creates enterprise release build and submits the build to App Center. |
| iOS | Cloud | Release | [`ios-cloud-release`](.github/workflows/ios-cloud-release.yml) | Creates release build and submits it to App Store Connect. |
| iOS (KMP) | Self-hosted | Test | [`ios-kmp-selfhosted-test`](.github/workflows/ios-kmp-selfhosted-test.yml) | Lints and tests the PR. |
| iOS (KMP) | Self-hosted | Build | [`ios-kmp-selfhosted-build`](.github/workflows/ios-kmp-selfhosted-build.yml) | Creates enterprise release build and submits the build to Futured App Store Connect. |
| iOS (KMP) | Self-hosted | Release | [`ios-kmp-selfhosted-release`](.github/workflows/ios-kmp-selfhosted-release.yml) | Creates release build and submits it to App Store Connect. |
| Android (+KMP) | Cloud | Tests & Lint checks | [`android-cloud-check`](.github/workflows/android-cloud-check.yml) | Runs unit tests and lint checks on pull request. |
| Android (+KMP) | Cloud | QA Snapshot Release | [`android-cloud-release-firebaseAppDistribution`](.github/workflows/android-cloud-release-firebaseAppDistribution.yml) | Releases QA Snapshot build to Firebase App Distribution. |

## Contributors

Expand Down

0 comments on commit a7e8faf

Please sign in to comment.