diff --git a/.github/workflows/deploy-release.yml b/.github/workflows/deploy-release.yml index 12ae94f7ee..3e04870367 100644 --- a/.github/workflows/deploy-release.yml +++ b/.github/workflows/deploy-release.yml @@ -1,32 +1,92 @@ -# This is a basic workflow that is manually triggered - name: Deploy Release -# Controls when the action will run. Workflow runs when manually triggered using the UI -# or API. +env: + main_project_module: app + on: workflow_dispatch: - # Inputs the workflow accepts. inputs: - name: - # Friendly description to be shown in the UI instead of 'name' - description: 'Person to greet' - # Default value if no value is explicitly provided - default: 'World' - # Input has to be provided for the workflow to run + 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 - # The data type of the input type: string - -# A workflow run is made up of one or more jobs that can run sequentially or in parallel + is_patch: + description: 'Is the new version a patch' + required: true + type: boolean + default: false + jobs: - # This workflow contains a single job called "greet" - greet: - # The type of runner that the job will run on + Build-Apk: runs-on: ubuntu-latest - - # Steps represent a sequence of tasks that will be executed as part of the job steps: - # Runs a single command using the runners shell - - name: Send greeting - run: echo "Hello ${{ inputs.name }}" + - uses: actions/checkout@v3 + - 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 "::set-output name=vName::$(grep 'vName' libs.versions.toml | awk -F' = ' '{print $2}' | tr -d '"')" + - name: Set Up JDK + uses: actions/setup-java@v3 + 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 }}-dhisPlayServices-release.apk + track: alpha + whatsNewDirectory: whatsnew + + + - name: Github Patch Release + if: ${{ (inputs.github_release == true) && (inputs.is_patch == true) }} + uses: ncipollo/release-action@v1 + with: + allowUpdates: true + draft: true + generateReleaseNotes: true + name: "Android Capture App for DHIS 2 (v${{ inputs.release_tag_name }}) - Patch version" + tag: ${{ inputs.release_tag_name }} + artifacts: ${{ env.main_project_module }}/build/outputs/apk/dhis/release/dhis2-v${{ steps.read-version.outputs.vName }}-dhis-release.apk,${{ env.main_project_module }}/build/outputs/apk/dhisPlayServices/release/dhis2-v${{ steps.read-version.outputs.vName }}-dhisPlayServices-release.apk,${{ env.main_project_module }}/build/outputs/apk/dhis/debug/dhis2-v${{ steps.read-version.outputs.vName }}-dhis-debug.apk + + - name: Github New Release + if: ${{ (inputs.github_release == true) && (inputs.is_patch == false) }} + uses: ncipollo/release-action@v1 + with: + allowUpdates: true + draft: true + generateReleaseNotes: true + 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 }}-dhis-release.apk,${{ env.main_project_module }}/build/outputs/apk/dhisPlayServices/release/dhis2-v${{ steps.read-version.outputs.vName }}-dhisPlayServices-release.apk,${{ env.main_project_module }}/build/outputs/apk/dhis/debug/dhis2-v${{ steps.read-version.outputs.vName }}-dhis-debug.apk diff --git a/app/src/dhisPlayServices/java/org/dhis2/utils/granularsync/GranularSyncModule.kt b/app/src/dhisPlayServices/java/org/dhis2/utils/granularsync/GranularSyncModule.kt index 44ec6a4b02..d40e2a78ec 100644 --- a/app/src/dhisPlayServices/java/org/dhis2/utils/granularsync/GranularSyncModule.kt +++ b/app/src/dhisPlayServices/java/org/dhis2/utils/granularsync/GranularSyncModule.kt @@ -73,6 +73,15 @@ class GranularSyncModule( ) } + @Provides + fun provideDispatchers() = object : DispatcherProvider { + override fun io() = Dispatchers.IO + + override fun computation() = Dispatchers.Default + + override fun ui() = Dispatchers.Main + } + @Provides fun granularSyncRepository( d2: D2, @@ -87,6 +96,7 @@ class GranularSyncModule( dhisProgramUtils, periodUtils, resourceManager, + provideDispatchers(), ) @Provides diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 8dfb18eaa9..d5222afc68 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -2,7 +2,7 @@ ndk = "21.4.7075529" sdk = "34" minSdk = "21" -vCode = "130" +vCode = "132" vName = "3.0" kotlinCompilerExtensionVersion = "1.5.6" gradle = "8.2.2"