Generating a FHIR Core Release 🚀 #76
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
name: Manual Release | |
run-name: Generating a FHIR Core Release 🚀 | |
on: | |
workflow_dispatch: | |
inputs: | |
buildType: | |
description: 'Select Build Type' | |
required: true | |
default: 'Release' | |
type: choice | |
options: | |
- Debug | |
- DebugNonProxy | |
- Release | |
flavor: | |
description: 'Release flavor e.g. sidBunda' | |
type: string | |
required: true | |
isAab: | |
description: 'Generate as AAB (Playstore release only)' | |
required: true | |
type: boolean | |
default: false | |
env: | |
MAPBOX_SDK_TOKEN: ${{ secrets.MAPBOX_SDK_TOKEN }} | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
contents: read | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Import Secrets from Vault | |
id: import-secrets | |
uses: hashicorp/vault-action@v2.8.0 | |
with: | |
url: https://vault.onalabs.org | |
token: ${{ secrets.VAULT_TOKEN }} | |
tlsSkipVerify: true | |
ignoreNotFound: true | |
secrets: | | |
kv-v2-fhircore/data/opensrp-shared KEYSTORE_FILE | KEYSTORE_FILE; | |
kv-v2-fhircore/data/opensrp-shared KEYSTORE_PROPERTIES_FILE | KEYSTORE_PROPERTIES_FILE; | |
kv-v2-fhircore/data/${{ github.event.inputs.flavor }} LOCAL_PROPERTIES_FILE | LOCAL_PROPERTIES_FILE; | |
- name: Checkout 🛎️ | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 2 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v1 | |
with: | |
java-version: 17 | |
- name: Grant execute permission for gradlew | |
run: chmod +x gradlew | |
working-directory: android | |
- name: Decode & Generate local.properties file | |
run: echo $LOCAL_PROPERTIES | base64 -di > local.properties | |
working-directory: android | |
env: | |
LOCAL_PROPERTIES: ${{ steps.import-secrets.outputs.LOCAL_PROPERTIES_FILE }} | |
- name: Decode & Generate Keystore file | |
run: echo $ENCODED_KEYSTORE | base64 -di > "${HOME}"/fhircore.keystore.jks | |
env: | |
ENCODED_KEYSTORE: ${{ steps.import-secrets.outputs.KEYSTORE_FILE }} | |
- name: Decode & Generate keystore.properties file | |
run: echo $KEYSTORE_PROPERTIES | base64 -di > keystore.properties | |
working-directory: android | |
env: | |
KEYSTORE_PROPERTIES: ${{ steps.import-secrets.outputs.KEYSTORE_PROPERTIES_FILE }} | |
- id: product-flavor | |
name: Generate Product Flavor identifier | |
run: | | |
flavorCapitalized=$(echo ${{ github.event.inputs.flavor }} | sed 's/.*/\u&/') | |
buildTypeCapitalized=$(echo ${{ github.event.inputs.buildType }} | sed 's/.*/\u&/') | |
buildTypeLowerlized=$(echo ${{ github.event.inputs.buildType }} | sed 's/.*/\l&/') | |
branchTag=$(echo ${{ github.ref }} | cut -d/ -f3) | |
echo "idCapitalized=$flavorCapitalized$buildTypeCapitalized" >> $GITHUB_OUTPUT | |
echo "buildTypeLowerlized=$buildTypeLowerlized" >> $GITHUB_OUTPUT | |
echo "branchTag=$branchTag" >> $GITHUB_OUTPUT | |
- name: Generate AAB (Android App Bundle) file | |
if: github.event.inputs.isAab == 'true' | |
run: ./gradlew :quest:bundle${{steps.product-flavor.outputs.idCapitalized}} --stacktrace | |
working-directory: android | |
- name: Upload AAB Artifact | |
if: github.event.inputs.isAab == 'true' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ steps.product-flavor.outputs.branchTag }}-${{ github.event.inputs.flavor }}-${{ steps.product-flavor.outputs.buildTypeLowerlized }}.aab | |
path: android/quest/build/outputs/bundle/${{ github.event.inputs.flavor }}${{ github.event.inputs.buildType }}/quest-${{ github.event.inputs.flavor }}-${{ steps.product-flavor.outputs.buildTypeLowerlized }}.aab | |
- name: Generate APK (Android App PacKage) file | |
if: github.event.inputs.isAab == 'false' | |
run: ./gradlew :quest:assemble${{steps.product-flavor.outputs.idCapitalized}} --stacktrace | |
working-directory: android | |
- name: Upload APK Artifact | |
if: github.event.inputs.isAab == 'false' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ steps.product-flavor.outputs.branchTag }}-${{ github.event.inputs.flavor }}-${{ steps.product-flavor.outputs.buildTypeLowerlized }}.apk | |
path: android/quest/build/outputs/apk/${{ github.event.inputs.flavor }}/${{ steps.product-flavor.outputs.buildTypeLowerlized }}/quest-${{ github.event.inputs.flavor }}-${{ steps.product-flavor.outputs.buildTypeLowerlized }}.apk | |