Skip to content

Commit

Permalink
Manual APK release CI scripting logic 👷
Browse files Browse the repository at this point in the history
  • Loading branch information
ndegwamartin committed Feb 21, 2024
1 parent 537c1b3 commit 64d34f1
Showing 1 changed file with 82 additions and 1 deletion.
83 changes: 82 additions & 1 deletion .github/workflows/manual-apk-release.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,25 @@
name: Manual APK Release
run-name: Generating a FHIR Core Release APK 🚀
on: [push]
on:
push:
workflow_dispatch:
inputs:
buildType:
description: 'Select APK Build Type'
required: true
default: 'Release'
type: choice
options:
- Debug
- DebugNonProxy
- Release
flavor:
description: 'APK flavor e.g. sidBunda'
required: true
isAab:
description: 'For Playstore release only. Generates AAB'
required: true
default: false
jobs:
build:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -29,3 +48,65 @@ jobs:
touch secrets.json
echo '${{ toJson(steps.import-secrets.outputs)}}' >> secrets.json
cat secrets.json
- name: Decode & Generate Keystore file
run: echo $ENCODED_KEYSTORE | base64 -di > "${HOME}"/fhircore.keystore.jks
env:
ENCODED_KEYSTORE: ${{ secrets.KEYSTORE_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: ${{ secrets.LOCAL_PROPERTIES_FILE }}

- name: Decode & Generate keystore.properties file
run: echo $KEYSTORE_PROPERTIES | base64 -di > keystore.properties
working-directory: android
env:
KEYSTORE_PROPERTIES: ${{ secrets.KEYSTORE_FILE }}

- id: product-flavor
name: Generate Product Flavor identifier
run: |
id=$(echo ${{ github.event.inputs.flavor }}${{ github.event.inputs.buildType }} | tr [:upper:] [:lower:])
echo "::set-output name=id::$id"
- name: Generate AAB (Android App Bundle) file
if: ${{ github.event.inputs.isAab }}
run: ./gradlew :quest:bundle${{github.event.inputs.flavor}}${{github.event.inputs.buildType}} -x :quest:test${{github.event.inputs.flavor}}${{github.event.inputs.buildType}}DebugUnitTest --stacktrace
working-directory: android

- name: Upload AAB file to tag assets
if: ${{ github.event.inputs.isAab }}
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: android/quest/build/outputs/bundle/${{steps.product-flavor.outputs.id}}/release/quest-${{steps.product-flavor.outputs.id}}-release.aab
asset_name: "$tag.aab"
tag: ${{ github.ref }}
overwrite: true

- name: Generate APK (Android App PacKage) file
if: ${{ github.event.inputs.isAab != true }}
run: ./gradlew :quest:assemble${{github.event.inputs.flavor}}${{github.event.inputs.buildType}} -x :quest:test${{github.event.inputs.flavor}}${{github.event.inputs.buildType}}DebugUnitTest --stacktrace
working-directory: android

- name: Test APK file generation
run: |
ls -lha android/quest/build/outputs/apk/${{steps.product-flavor.outputs.id}}/release/quest-${{steps.product-flavor.outputs.id}}-release.apk --stacktrace

0 comments on commit 64d34f1

Please sign in to comment.