Deploy Release #39
Workflow file for this run
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: Deploy Release | |
env: | |
main_project_module: app | |
on: | |
workflow_dispatch: | |
inputs: | |
github_release: | |
description: 'enable github release' | |
required: true | |
type: boolean | |
google_play_release: | |
description: 'enable google play release' | |
required: true | |
type: boolean | |
release_tag_name: | |
description: 'tag' | |
required: true | |
type: string | |
jobs: | |
Build-Apk: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set repository name as env variable | |
run: echo "repository_name=$(echo '${{ github.repository }}' | awk -F '/' '{print $2}')" >> $GITHUB_ENV | |
- name: Read version name from file | |
working-directory: ./gradle | |
id: read-version | |
run: echo "vName=$(grep 'vName' libs.versions.toml | awk -F' = ' '{print $2}' | tr -d '\"')" >> $GITHUB_ENV | |
- name: Set Up JDK | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'zulu' # See 'Supported distributions' for available options | |
java-version: '17' | |
cache: 'gradle' | |
- name: Change wrapper permissions | |
run: chmod +x ./gradlew | |
- name: Decode Keystore | |
id: decode_keystore | |
uses: timheuer/base64-to-file@v1 | |
with: | |
fileName: 'dhis_keystore.jks' | |
encodedString: ${{ secrets.KEYSTORE }} | |
- name: Build release apk | |
run: ./gradlew app:assembleRelease app:assembleDhisDebug | |
env: | |
SENTRY_DSN: ${{ secrets.SENTRY_DSN }} | |
SIGNING_KEY_ALIAS: ${{ secrets.KEY_ALIAS }} | |
SIGNING_KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }} | |
SIGNING_STORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }} | |
SIGNING_KEYSTORE_PATH: ${{ steps.decode_keystore.outputs.filePath }} | |
- name: Upload to Play Store | |
if: ${{ inputs.google_play_release }} | |
uses: r0adkll/upload-google-play@v1 | |
with: | |
serviceAccountJsonPlainText: ${{ secrets.SERVICE_ACCOUNT_JSON }} | |
packageName: com.dhis2 | |
releaseFiles: ${{ env.main_project_module }}/build/outputs/apk/dhisPlayServices/release/dhis2-v${{ steps.read-version.outputs.vName }}-googlePlay.apk | |
track: production | |
status: inProgress | |
whatsNewDirectory: whatsnew | |
userFraction: 0.99 | |
- name: Upload to Github | |
if: ${{ inputs.github_release }} | |
uses: ncipollo/release-action@v1 | |
with: | |
allowUpdates: true | |
draft: true | |
bodyFile: "RELEASE.md" | |
name: "Android Capture App for DHIS 2 (v${{ inputs.release_tag_name }})" | |
tag: ${{ inputs.release_tag_name }} | |
artifacts: ${{ env.main_project_module }}/build/outputs/apk/dhis/release/dhis2-v${{ steps.read-version.outputs.vName }}.apk,${{ env.main_project_module }}/build/outputs/apk/dhisPlayServices/release/dhis2-v${{ steps.read-version.outputs.vName }}-googlePlay.apk,${{ env.main_project_module }}/build/outputs/apk/dhis/debug/dhis2-v${{ steps.read-version.outputs.vName }}-training.apk |