Skip to content

Build QA Release and Distribute on Firebase #187

Build QA Release and Distribute on Firebase

Build QA Release and Distribute on Firebase #187

name: Build QA Release and Distribute on Firebase
on:
workflow_dispatch:
inputs:
environment:
type: environment
description: 'Select between "production" and "development" as the environment.'
required: true
default: 'production'
buildType:
type: choice
description: 'Select between "release" and "debug" as build types.'
required: true
options:
- "release"
- "debug"
default: 'release'
env:
# Mapbox SDK secrets
ORG_GRADLE_PROJECT_MAPBOX_ACCESS_TOKEN: ${{ secrets.MAPBOX_ACCESS_TOKEN }}
ORG_GRADLE_PROJECT_MAPBOX_DOWNLOADS_TOKEN: ${{ secrets.MAPBOX_DOWNLOADS_TOKEN }}
ORG_GRADLE_PROJECT_MAPBOX_STYLE: ${{ secrets.MAPBOX_STYLE }}
# Release key information
ORG_GRADLE_PROJECT_RELEASE_KEYSTORE: ${{ secrets.RELEASE_KEYSTORE }}
ORG_GRADLE_PROJECT_RELEASE_KEYSTORE_PASSWORD: ${{ secrets.RELEASE_KEYSTORE_PASSWORD }}
ORG_GRADLE_PROJECT_RELEASE_KEY_ALIAS: ${{ secrets.RELEASE_KEY_ALIAS }}
ORG_GRADLE_PROJECT_RELEASE_KEY_PASSWORD: ${{ secrets.RELEASE_KEY_PASSWORD }}
# Debug key information
ORG_GRADLE_PROJECT_DEBUG_KEYSTORE: ${{ secrets.DEBUG_KEYSTORE }}
ORG_GRADLE_PROJECT_DEBUG_KEYSTORE_PASSWORD: ${{ secrets.DEBUG_KEYSTORE_PASSWORD }}
ORG_GRADLE_PROJECT_DEBUG_KEY_ALIAS: ${{ secrets.DEBUG_KEY_ALIAS }}
ORG_GRADLE_PROJECT_DEBUG_KEY_PASSWORD: ${{ secrets.DEBUG_KEY_PASSWORD }}
# Firebase distribution only on QA Group
ORG_GRADLE_PROJECT_FIREBASE_TEST_GROUP: ${{ secrets.FIREBASE_QA_TEST_GROUP }}
# Gradle config
GRADLE_USER_HOME: ${GITHUB_WORKSPACE}/.gradle
GLOBAL_GRADLE_CACHE: gradle-cache-${GITHUB_REPOSITORY}
jobs:
qa_dist:
environment: ${{ github.event.inputs.environment }}
env:
# API URL for the environment selected
ORG_GRADLE_PROJECT_API_URL: ${{ secrets.API_URL }}
# Claim DApp URL
ORG_GRADLE_PROJECT_CLAIM_APP_URL: ${{ secrets.CLAIM_APP_URL }}
# Mixpanel Token
ORG_GRADLE_PROJECT_MIXPANEL_TOKEN: ${{ secrets.MIXPANEL_TOKEN }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Re-fetch all tags # WA: https://github.com/actions/checkout/issues/882
run: git fetch --tags --force origin
- name: Gradle package cache
uses: actions/cache@v4
with:
key: ${{ env.GLOBAL_GRADLE_CACHE }}
path: ${{ env.GRADLE_USER_HOME }}
- name: Decode secrets
run: |
echo "${{ secrets.ENCODED_GOOGLE_SERVICES }}" | base64 -d > ./app/google-services.json
echo "${{ secrets.ENCODED_SERVICE_ACCOUNT }}" | base64 -d > ./ci-service-account.json
echo "${{ secrets.ENCODED_RELEASE_KEYSTORE }}" > release-keystore.asc
echo "${{ secrets.ENCODED_DEBUG_KEYSTORE }}" > debug-keystore.asc
gpg -d --passphrase "${{ secrets.ENCODED_RELEASE_KEYSTORE_PASSPHRASE }}" --batch release-keystore.asc > ./${{ secrets.RELEASE_KEYSTORE }}
gpg -d --passphrase "${{ secrets.DEBUG_KEYSTORE_PASSWORD }}" --batch debug-keystore.asc > ./${{ secrets.DEBUG_KEYSTORE }}
- name: Setup JDK 17
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
- name: Build production release for the QA Team and distribute on Firebase
if: ${{ github.event.inputs.environment == 'production' && github.event.inputs.buildType == 'release' }}
run: |
./gradlew :app:assembleRemoteProdRelease :app:appDistributionUploadRemoteProdRelease -PSKIP_PRODUCTION_ENV
rm ./ci-service-account.json
- name: Build production debug for the QA Team and distribute on Firebase
if: ${{ github.event.inputs.environment == 'production' && github.event.inputs.buildType == 'debug' }}
run: |
./gradlew :app:assembleRemoteProdRelease :app:appDistributionUploadRemoteProdRelease -PSKIP_PRODUCTION_ENV
rm ./ci-service-account.json
- name: Build development release for the QA Team and distribute on Firebase
if: ${{ github.event.inputs.environment == 'development' && github.event.inputs.buildType == 'release' }}
run: |
./gradlew :app:assembleRemoteDevRelease :app:appDistributionUploadRemoteDevRelease -PSKIP_PRODUCTION_ENV
rm ./ci-service-account.json
- name: Build development debug for the QA Team and distribute on Firebase
if: ${{ github.event.inputs.environment == 'development' && github.event.inputs.buildType == 'debug' }}
run: |
./gradlew :app:assembleRemoteDevDebug :app:appDistributionUploadRemoteDevDebug -PSKIP_PRODUCTION_ENV
rm ./ci-service-account.json