Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: dhis2/dhis2-android-capture-app
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 2.9
Choose a base ref
...
head repository: dhis2/dhis2-android-capture-app
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: main
Choose a head ref
Loading
Showing 1,717 changed files with 54,772 additions and 50,769 deletions.
65 changes: 65 additions & 0 deletions .github/workflows/build-release-candidate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# This is a basic workflow that is manually triggered

name: Build Release Candidate

env:
# The name of the main module repository
main_project_module: app

# Controls when the action will run. Workflow runs when manually triggered using the UI
# or API.
on:
workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "greet"
greet:
# The type of runner that the job will run on
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
- uses: actions/checkout@v3

# Set Repository Name As Env Variable
- name: Set repository name as env variable
run: echo "repository_name=$(echo '${{ github.repository }}' | awk -F '/' '{print $2}')" >> $GITHUB_ENV

- 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 prod
run: ./gradlew app:assembleDhisRelease
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: 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 '"')"

# Upload Artifact Build
- name: Upload Android artifacts
uses: actions/upload-artifact@v3
with:
name: ${{ env.repository_name }} - Android APK
path: ${{ env.main_project_module }}/build/outputs/apk/dhis/release/dhis2-v${{ steps.read-version.outputs.vName }}.apk
59 changes: 59 additions & 0 deletions .github/workflows/continuous-delivery.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Continuous Delivery

env:

main_project_module: app

on:
workflow_dispatch:
push:
branches:
- main
- develop
- release/*
pull_request:
branches:
- main
- develop
- release/*

jobs:
deployment_job:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

# Set Current Date
- name: Set current date
id: date
run: echo "date=$(date +'%Y-%m-%d')" >> "$GITHUB_OUTPUT"

# Set Repository Name As Env Variable
- name: Set repository name as env variable
run: echo "repository_name=$(echo '${{ github.repository }}' | awk -F '/' '{print $2}')" >> $GITHUB_ENV

- name: Set Up JDK
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '17'
cache: 'gradle'

- name: Change wrapper permissions
run: chmod +x ./gradlew

# Create APK Debug
- name: Build apk debug project (APK) - ${{ env.main_project_module }} module
run: ./gradlew assembleDhisDebug

- 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_OUTPUT"

# Upload Artifact Build
- name: Upload Android artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ env.repository_name }} - Android APK - ${{ steps.date.outputs.date }}
path: ${{ env.main_project_module }}/build/outputs/apk/dhis/debug/dhis2-v${{ steps.read-version.outputs.vName }}-training.apk
77 changes: 77 additions & 0 deletions .github/workflows/deploy-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
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 "::set-output name=vName::$(grep 'vName' libs.versions.toml | awk -F' = ' '{print $2}' | tr -d '"')"
- 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
32 changes: 32 additions & 0 deletions .github/workflows/publish-libraries.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# This is a basic workflow that is manually triggered

name: Publish libraries

# Controls when the action will run. Workflow runs when manually triggered using the UI
# or API.
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
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
jobs:
# This workflow contains a single job called "greet"
greet:
# The type of runner that the job will run on
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 }}"
17 changes: 7 additions & 10 deletions .github/workflows/release-generate-notes.yml
Original file line number Diff line number Diff line change
@@ -22,19 +22,16 @@ jobs:
steps:

- uses: actions/checkout@v3
with:
token: ${{ secrets.DHIS2_BOT_GITHUB_TOKEN }}

# Generate github release notes
- name: Generate release notes
working-directory: ./scripts
run: python3 generateReleaseNotes.py

- name: setup git config
run: |
# setup the username and email.
git config user.name "GitHub Actions Bot"
git config user.email "<android@dhis2.org>"
- name: Commit changes
run: |
# Commit and push
git commit -am "Update release notes"
git push
uses: flex-development/gh-commit@1.0.0
with:
message: "Update release notes"
token: ${{ secrets.DHIS2_BOT_GITHUB_TOKEN }}
99 changes: 86 additions & 13 deletions .github/workflows/release-start.yml
Original file line number Diff line number Diff line change
@@ -2,27 +2,100 @@

name: Release start

# Controls when the action will run. Workflow runs when manually triggered using the UI
# or API.
on:
workflow_dispatch:
# Inputs the workflow accepts.
inputs:
version_name:
description: 'Release version name'
release_version_name:
description: 'New release version name'
required: true
type: string

development_version_name:
description: 'Development version name'
required: true
type: string

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
create_branch:
# The type of runner that the job will run on
runs-on: ubuntu-latest
env:
RELEASE_VERSION: ${{ inputs.release_version_name }}
RELEASE_BRANCH: 'release/${{ inputs.release_version_name }}'
TEMP_RELEASE_BRANCH: 'tmp_release/${{ inputs.release_version_name }}'

steps:
- uses: actions/checkout@v3
# override vName with new version
- name: Create release branch
run: git checkout -b release/${{ inputs.version_name }}
- name: Push
run: git push origin release/${{ inputs.version_name }}
- name: Check out code
uses: actions/checkout@v4
with:
token: ${{ secrets.DHIS2_BOT_GITHUB_TOKEN }}

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.12.1

# Creates an auxiliary branch. This branch will be used to create the signed commit using the GH API.
# It is required to use an auxiliary branch because the RELEASE_BRANCH is protected and the GH API
# rejects the commit even though the user identified by the token is included in the bypass list.
- name: Create auxiliary branch
run: |
git checkout -b ${{ env.TEMP_RELEASE_BRANCH }}
git push origin ${{ env.TEMP_RELEASE_BRANCH }}
- name: Run Python script to update release branch version
run: python scripts/updateVersionName.py ${{ env.RELEASE_VERSION }}

# Uses the GH API to create the signed commit.
- name: Commit and Push Changes to auxiliary branch
uses: flex-development/gh-commit@1.0.0
with:
message: 'Update version to ${{ env.RELEASE_VERSION }}'
ref: ${{ env.TEMP_RELEASE_BRANCH }}
token: ${{ secrets.DHIS2_BOT_GITHUB_TOKEN }}

# Fetch the remote commit (signed commit) and create a new branch with the RELEASE_BRANCH name.
# This is required because the RELEASE_BRANCH is protected.
- name: Create and push release branch
run: |
git reset --hard
git pull origin ${{ env.TEMP_RELEASE_BRANCH }}
git checkout -b ${{ env.RELEASE_BRANCH }}
git push origin ${{ env.RELEASE_BRANCH }}
git push origin --delete ${{ env.TEMP_RELEASE_BRANCH }}
update_version:
runs-on: ubuntu-latest
env:
DEVELOPMENT_VERSION: ${{ inputs.development_version_name }}
DEVELOPMENT_BRANCH: 'update_version_to${{ inputs.development_version_name }}'

steps:
- name: Check out code
uses: actions/checkout@v4
with:
token: ${{ secrets.DHIS2_BOT_GITHUB_TOKEN }}

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.12.1

- name: Create development branch
run: |
git checkout -b ${{ env.DEVELOPMENT_BRANCH }}
git push origin ${{ env.DEVELOPMENT_BRANCH }}
- name: Run Python script to update base branch version
run: python scripts/updateVersionName.py ${{ env.DEVELOPMENT_VERSION }}

- name: Commit and Push Changes
uses: flex-development/gh-commit@1.0.0
with:
message: 'Update version to ${{ env.DEVELOPMENT_VERSION }}'
ref: ${{ env.DEVELOPMENT_BRANCH }}
token: ${{ secrets.DHIS2_BOT_GITHUB_TOKEN }}

- name: Create pull request
run: gh pr create -B develop -H update_version_to${{ env.DEVELOPMENT_VERSION }} --title 'Merge ${{ env.DEVELOPMENT_BRANCH }} into develop' --body 'Created by Github action'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -11,3 +11,4 @@
/venv
/*.secrets.yml
/gradle.deps
.kotlin/
Loading