From e56566b24b13e167040fb4d4408e69ad90fc82b9 Mon Sep 17 00:00:00 2001 From: Xavier Molloy Date: Wed, 22 May 2024 08:39:23 +0200 Subject: [PATCH 01/12] feat: [ANDROAPP-6165] add continuous-delivery job for apk generation, that is independent from CI success or PRs --- .github/workflows/continuous-delivery.yml | 59 +++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 .github/workflows/continuous-delivery.yml diff --git a/.github/workflows/continuous-delivery.yml b/.github/workflows/continuous-delivery.yml new file mode 100644 index 0000000000..90f2eb1442 --- /dev/null +++ b/.github/workflows/continuous-delivery.yml @@ -0,0 +1,59 @@ +name: Continuous Delivery + +env: + + main_project_module: app + current_date: ${{ github.event.inputs.date_today }} + current_branch: ${{ github.ref }} + +on: + push: + branches: + - main + - develop + - release/* + - ANDROAPP-* + + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +jobs: + deployment_job: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + # Set Current Date As Env Variable + - name: Set current date as env variable + run: echo "date_today=$(date +'%Y-%m-%d')" >> $GITHUB_ENV + + # 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' + 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 "::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 ${{ env.current_date }} Branch - ${{ env.current_branch }} + path: ${{ env.main_project_module }}/build/outputs/apk/dhis/debug/dhis2-v${{ steps.read-version.outputs.vName }}-dhis-debug.apk From 5f496f8f5e52e3be4317f136e65d5b9909de8a59 Mon Sep 17 00:00:00 2001 From: Xavier Molloy Date: Wed, 22 May 2024 08:53:17 +0200 Subject: [PATCH 02/12] feat: [ANDROAPP-6165] remove branch ref and try and show date for apk file --- .github/workflows/continuous-delivery.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/continuous-delivery.yml b/.github/workflows/continuous-delivery.yml index 90f2eb1442..d380ab9c3f 100644 --- a/.github/workflows/continuous-delivery.yml +++ b/.github/workflows/continuous-delivery.yml @@ -3,8 +3,6 @@ name: Continuous Delivery env: main_project_module: app - current_date: ${{ github.event.inputs.date_today }} - current_branch: ${{ github.ref }} on: push: @@ -14,7 +12,6 @@ on: - release/* - ANDROAPP-* - # Allows you to run this workflow manually from the Actions tab workflow_dispatch: @@ -55,5 +52,5 @@ jobs: - name: Upload Android artifacts uses: actions/upload-artifact@v3 with: - name: ${{ env.repository_name }} - Android APK ${{ env.current_date }} Branch - ${{ env.current_branch }} + name: ${{ env.repository_name }} - Android APK ${{ env.current_date }} ${{ steps.date.outputs.date }} path: ${{ env.main_project_module }}/build/outputs/apk/dhis/debug/dhis2-v${{ steps.read-version.outputs.vName }}-dhis-debug.apk From 6b7977335edfee4f2bf52bffe3fb862951ea8529 Mon Sep 17 00:00:00 2001 From: Xavier Molloy Date: Wed, 22 May 2024 09:07:46 +0200 Subject: [PATCH 03/12] feat: [ANDROAPP-6165] check workflow dispatch and modify date recollection --- .github/workflows/continuous-delivery.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/continuous-delivery.yml b/.github/workflows/continuous-delivery.yml index d380ab9c3f..7bdb93edd9 100644 --- a/.github/workflows/continuous-delivery.yml +++ b/.github/workflows/continuous-delivery.yml @@ -5,6 +5,7 @@ env: main_project_module: app on: + workflow_dispatch: push: branches: - main @@ -12,9 +13,6 @@ on: - release/* - ANDROAPP-* - # Allows you to run this workflow manually from the Actions tab - workflow_dispatch: - jobs: deployment_job: runs-on: ubuntu-latest @@ -23,6 +21,7 @@ jobs: # Set Current Date As Env Variable - name: Set current date as env variable + id: date run: echo "date_today=$(date +'%Y-%m-%d')" >> $GITHUB_ENV # Set Repository Name As Env Variable @@ -52,5 +51,5 @@ jobs: - name: Upload Android artifacts uses: actions/upload-artifact@v3 with: - name: ${{ env.repository_name }} - Android APK ${{ env.current_date }} ${{ steps.date.outputs.date }} + name: ${{ env.repository_name }} - Android APK ${{ env.current_date }} - ${{ steps.date.outputs.date }} path: ${{ env.main_project_module }}/build/outputs/apk/dhis/debug/dhis2-v${{ steps.read-version.outputs.vName }}-dhis-debug.apk From faccd32e1c53732db1a08becfd8fd8473d74b281 Mon Sep 17 00:00:00 2001 From: Xavier Molloy Date: Wed, 22 May 2024 09:17:39 +0200 Subject: [PATCH 04/12] feat: [ANDROAPP-6165] workflow dispatch test --- .github/workflows/continuous-delivery.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/continuous-delivery.yml b/.github/workflows/continuous-delivery.yml index 7bdb93edd9..97ce00ec50 100644 --- a/.github/workflows/continuous-delivery.yml +++ b/.github/workflows/continuous-delivery.yml @@ -1,4 +1,4 @@ -name: Continuous Delivery +name: Continuous change name test env: @@ -22,7 +22,7 @@ jobs: # Set Current Date As Env Variable - name: Set current date as env variable id: date - run: echo "date_today=$(date +'%Y-%m-%d')" >> $GITHUB_ENV + run: echo "::set-output name=date::$(date +'%Y-%m-%d')" # Set Repository Name As Env Variable - name: Set repository name as env variable From d939154732cac01d002d5ec5ecffb8ae279fdeb0 Mon Sep 17 00:00:00 2001 From: Xavier Molloy Date: Wed, 22 May 2024 09:31:35 +0200 Subject: [PATCH 05/12] feat: [ANDROAPP-6165] workflow dispatch test with feature branch --- .github/workflows/continuous-delivery.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/continuous-delivery.yml b/.github/workflows/continuous-delivery.yml index 97ce00ec50..6d2c3564eb 100644 --- a/.github/workflows/continuous-delivery.yml +++ b/.github/workflows/continuous-delivery.yml @@ -1,4 +1,4 @@ -name: Continuous change name test +name: Continuous delivery env: @@ -11,7 +11,7 @@ on: - main - develop - release/* - - ANDROAPP-* + - ANDROAPP-6165-CI-Migrate-ReadyForTestingAPK-job-from-Bitrise-to-GIthub-Actions jobs: deployment_job: From a3cbafd1e0af752fd87eae16093cff66575fa698 Mon Sep 17 00:00:00 2001 From: Xavier Molloy Date: Wed, 22 May 2024 09:44:28 +0200 Subject: [PATCH 06/12] feat: [ANDROAPP-6165] update deprecated apis --- .github/workflows/continuous-delivery.yml | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/.github/workflows/continuous-delivery.yml b/.github/workflows/continuous-delivery.yml index 6d2c3564eb..1b4efa625d 100644 --- a/.github/workflows/continuous-delivery.yml +++ b/.github/workflows/continuous-delivery.yml @@ -1,4 +1,4 @@ -name: Continuous delivery +name: Continuous Delivery env: @@ -11,25 +11,24 @@ on: - main - develop - release/* - - ANDROAPP-6165-CI-Migrate-ReadyForTestingAPK-job-from-Bitrise-to-GIthub-Actions + - ANDROAPP-* jobs: deployment_job: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 # Set Current Date As Env Variable - name: Set current date as env variable id: date - run: echo "::set-output name=date::$(date +'%Y-%m-%d')" - + run: echo "name=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@v3 + uses: actions/setup-java@v4 with: distribution: 'zulu' java-version: '17' @@ -49,7 +48,7 @@ jobs: # Upload Artifact Build - name: Upload Android artifacts - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: ${{ env.repository_name }} - Android APK ${{ env.current_date }} - ${{ steps.date.outputs.date }} path: ${{ env.main_project_module }}/build/outputs/apk/dhis/debug/dhis2-v${{ steps.read-version.outputs.vName }}-dhis-debug.apk From 01d7f22785b89a6fa62c9ada19bfd9a8cc3c3073 Mon Sep 17 00:00:00 2001 From: Xavier Molloy Date: Wed, 22 May 2024 10:02:29 +0200 Subject: [PATCH 07/12] feat: [ANDROAPP-6165] fix github output for deprecated command --- .github/workflows/continuous-delivery.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/continuous-delivery.yml b/.github/workflows/continuous-delivery.yml index 1b4efa625d..80ad898909 100644 --- a/.github/workflows/continuous-delivery.yml +++ b/.github/workflows/continuous-delivery.yml @@ -22,7 +22,9 @@ jobs: # Set Current Date As Env Variable - name: Set current date as env variable id: date - run: echo "name=date::$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT + + 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 From 18c4933dad06f1fa5bb4112315f8f7a5682386c7 Mon Sep 17 00:00:00 2001 From: Xavier Molloy Date: Wed, 22 May 2024 10:20:44 +0200 Subject: [PATCH 08/12] feat: [ANDROAPP-6165] revert to set output command --- .github/workflows/continuous-delivery.yml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/continuous-delivery.yml b/.github/workflows/continuous-delivery.yml index 80ad898909..090747babf 100644 --- a/.github/workflows/continuous-delivery.yml +++ b/.github/workflows/continuous-delivery.yml @@ -19,11 +19,10 @@ jobs: steps: - uses: actions/checkout@v4 - # Set Current Date As Env Variable - - name: Set current date as env variable + # Set Current Date + - name: Set current date id: date - - run: echo "{date}={$(date +'%Y-%m-%d')}" >> $GITHUB_OUTPUT + run: echo "::set-output name=date::$(date +'%Y-%m-%d')" # Set Repository Name As Env Variable - name: Set repository name as env variable @@ -52,5 +51,5 @@ jobs: - name: Upload Android artifacts uses: actions/upload-artifact@v4 with: - name: ${{ env.repository_name }} - Android APK ${{ env.current_date }} - ${{ steps.date.outputs.date }} + 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 }}-dhis-debug.apk From baaa78ec309c6657a245c542c607fb73d7c7ab32 Mon Sep 17 00:00:00 2001 From: Xavier Molloy Date: Wed, 22 May 2024 10:24:14 +0200 Subject: [PATCH 09/12] feat: [ANDROAPP-6165] test date set output command --- .github/workflows/continuous-delivery.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/continuous-delivery.yml b/.github/workflows/continuous-delivery.yml index 090747babf..9fd809205b 100644 --- a/.github/workflows/continuous-delivery.yml +++ b/.github/workflows/continuous-delivery.yml @@ -22,7 +22,7 @@ jobs: # Set Current Date - name: Set current date id: date - run: echo "::set-output name=date::$(date +'%Y-%m-%d')" + run: echo "date=$(date +'%Y-%m-%d')" >> "$GITHUB_OUTPUT" # Set Repository Name As Env Variable - name: Set repository name as env variable From b9001d7b80ff9376b838b6a3ae3ec0f17dbe373f Mon Sep 17 00:00:00 2001 From: Xavier Molloy Date: Wed, 22 May 2024 10:42:31 +0200 Subject: [PATCH 10/12] feat: [ANDROAPP-6165] change version name step to updated api --- .github/workflows/continuous-delivery.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/continuous-delivery.yml b/.github/workflows/continuous-delivery.yml index 9fd809205b..1daca38592 100644 --- a/.github/workflows/continuous-delivery.yml +++ b/.github/workflows/continuous-delivery.yml @@ -22,7 +22,7 @@ jobs: # Set Current Date - name: Set current date id: date - run: echo "date=$(date +'%Y-%m-%d')" >> "$GITHUB_OUTPUT" + run: echo "date=$('%Y-%m-%d')" >> "$GITHUB_OUTPUT" # Set Repository Name As Env Variable - name: Set repository name as env variable @@ -45,7 +45,7 @@ jobs: - 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 '"')" + run: echo "vName=$(grep 'vName' libs.versions.toml | awk -F' = ' '{print $2}' | tr -d '"')" >> "$GITHUB_OUTPUT" # Upload Artifact Build - name: Upload Android artifacts From 09be870960e482c25a853375f1351e061a64f00b Mon Sep 17 00:00:00 2001 From: Xavier Molloy Date: Wed, 22 May 2024 10:51:36 +0200 Subject: [PATCH 11/12] feat: [ANDROAPP-6165] update date uotput --- .github/workflows/continuous-delivery.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/continuous-delivery.yml b/.github/workflows/continuous-delivery.yml index 1daca38592..1122215508 100644 --- a/.github/workflows/continuous-delivery.yml +++ b/.github/workflows/continuous-delivery.yml @@ -22,7 +22,7 @@ jobs: # Set Current Date - name: Set current date id: date - run: echo "date=$('%Y-%m-%d')" >> "$GITHUB_OUTPUT" + run: echo "date=$(date +'%Y-%m-%d')" >> "$GITHUB_OUTPUT" # Set Repository Name As Env Variable - name: Set repository name as env variable From a880a1f3635fe8c23df4a2fac88f1a707da1b0aa Mon Sep 17 00:00:00 2001 From: Xavier Molloy Date: Wed, 22 May 2024 17:00:12 +0200 Subject: [PATCH 12/12] ci: [ANDROAPP-6165] add continuous-delivery job to github --- .github/workflows/continuous-delivery.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/continuous-delivery.yml b/.github/workflows/continuous-delivery.yml index 1122215508..c74716e987 100644 --- a/.github/workflows/continuous-delivery.yml +++ b/.github/workflows/continuous-delivery.yml @@ -11,7 +11,6 @@ on: - main - develop - release/* - - ANDROAPP-* jobs: deployment_job: