Automatic GitHub build for mobile applications

For the policies_android_app_java and claims_android_app_java the github actions use 2 workflows for the CD. We have the automatic build workflow in the file main.yml and the manual build workflow in the file manual.yml.

The automatic build workflow has configured to start in every push on the repository branch. It takes place at 3 stages:

  • setup the JDK version

  • build apk file for debug package

  • build aab file for release package

name: CI on: push: branches: - '*' # tags: # - '!v*' jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - name: Setup JDK 17 uses: actions/setup-java@v2 with: distribution: 'temurin' java-version: '17' cache: 'gradle' - name: Environment info run: | gradle --version - name: build run: | ./gradlew assembleDebug --stacktrace - name: Environment info run: | gradle --version - uses: actions/upload-artifact@v4 with: name: openimis-policies-apk-${{github.run_number}}-${{github.sha}} path: ./app/build/outputs/**/*.apk - name: build run: | ./gradlew bundleDebug --stacktrace - name: Environment info run: | gradle --version - uses: actions/upload-artifact@v4 with: name: openimis-policies-aab-${{github.run_number}}-${{github.sha}} path: ./app/build/outputs/**/*.aab

 

The manual workflow is configured to take many field like api_base_url, application_name, application_id at the enter before run workflow. First we have to choose the branch and define the field to start the deployment.

 

For this 2 workflows, if the user want ton build a specific variant in build.gradle, he must replace assembleDebug by assemble{variant_name}Debug in the build task. For example if we want to build demo variant, the command in build task will become

./gradlew assembledemoProdDebug --stacktrace

Did you encounter a problem or do you have a suggestion?

Please contact our Service Desk



This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License. https://creativecommons.org/licenses/by-sa/4.0/