From 9a494db5b72d2cf0350dd190c84c0309f6e24170 Mon Sep 17 00:00:00 2001 From: Steffen Zschaler Date: Thu, 27 Mar 2025 15:18:01 +0000 Subject: [PATCH 1/7] Split dev-merge workflow into steps build should run on any commit while deploy only happens when merging the PR --- .github/workflows/dev_merge.yml | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/.github/workflows/dev_merge.yml b/.github/workflows/dev_merge.yml index 87eb3ddda..e92710120 100644 --- a/.github/workflows/dev_merge.yml +++ b/.github/workflows/dev_merge.yml @@ -1,16 +1,13 @@ -# This workflow will build a Java project with Ant -# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-ant - +# Build a PR merging into the develop branch and deploy to the develop update site if PR is merged. name: Dev Build on: pull_request: branches: [ develop ] - types: [ closed ] + types: [ synchronize, closed ] # Run when there are updates to the code in the PR or when the PR is closed and merged jobs: - deploy: - if: ${{ github.event.pull_request.merged }} + build: runs-on: ubuntu-latest steps: @@ -26,10 +23,18 @@ jobs: working-directory: ./build/ant run: | ant -noinput -buildfile build.xml + + deploy: + needs: build + if: ${{ github.event.pull_request.merged }} + runs-on: ubuntu-latest + + steps: - name: Deploy files shell: bash - run: | - /usr/bin/chmod +x ./build/publish-artifacts.sh - /usr/bin/bash ./build/publish-artifacts.sh + # run: | + # /usr/bin/chmod +x ./build/publish-artifacts.sh + # /usr/bin/bash ./build/publish-artifacts.sh + run: echo "Would deploy at this point..." env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 224b4dd31d8a66aeb60bf3a488ccbc142270c0dd Mon Sep 17 00:00:00 2001 From: Steffen Zschaler Date: Thu, 27 Mar 2025 15:41:27 +0000 Subject: [PATCH 2/7] Test development deploy action --- .github/workflows/dev_merge.yml | 11 ++++++----- build/maven/build.xml | 3 ++- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/.github/workflows/dev_merge.yml b/.github/workflows/dev_merge.yml index e92710120..bf587d08d 100644 --- a/.github/workflows/dev_merge.yml +++ b/.github/workflows/dev_merge.yml @@ -26,15 +26,16 @@ jobs: deploy: needs: build - if: ${{ github.event.pull_request.merged }} + # Temporarily removing the condition, so can test... + # if: ${{ github.event.pull_request.merged }} runs-on: ubuntu-latest steps: - name: Deploy files shell: bash - # run: | - # /usr/bin/chmod +x ./build/publish-artifacts.sh - # /usr/bin/bash ./build/publish-artifacts.sh - run: echo "Would deploy at this point..." + run: | + /usr/bin/chmod +x ./build/publish-artifacts.sh + /usr/bin/bash ./build/publish-artifacts.sh + # run: echo "Would deploy at this point..." env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/build/maven/build.xml b/build/maven/build.xml index b1602d657..3a7947f44 100644 --- a/build/maven/build.xml +++ b/build/maven/build.xml @@ -21,7 +21,8 @@ - + + From c205555756d06b806fb62d5667cea31d73f46b99 Mon Sep 17 00:00:00 2001 From: Steffen Zschaler Date: Thu, 27 Mar 2025 15:52:15 +0000 Subject: [PATCH 3/7] Reorganise GitHub actions to remove redundancies --- .../workflows/{dev_merge.yml => ci-cd.yml} | 10 +++--- .github/workflows/commit.yml | 28 --------------- .github/workflows/master_merge.yml | 35 ------------------- 3 files changed, 5 insertions(+), 68 deletions(-) rename .github/workflows/{dev_merge.yml => ci-cd.yml} (73%) delete mode 100644 .github/workflows/commit.yml delete mode 100644 .github/workflows/master_merge.yml diff --git a/.github/workflows/dev_merge.yml b/.github/workflows/ci-cd.yml similarity index 73% rename from .github/workflows/dev_merge.yml rename to .github/workflows/ci-cd.yml index bf587d08d..402b2c0ff 100644 --- a/.github/workflows/dev_merge.yml +++ b/.github/workflows/ci-cd.yml @@ -1,13 +1,13 @@ -# Build a PR merging into the develop branch and deploy to the develop update site if PR is merged. -name: Dev Build +# Build and potentially deploy code on PRs merging into the develop or master branch +name: CI/CD on: pull_request: - branches: [ develop ] - types: [ synchronize, closed ] # Run when there are updates to the code in the PR or when the PR is closed and merged + branches: [ master, develop ] + types: [assigned, opened, synchronize, reopened, closed ] # Run when there are updates to the code in the PR or when the PR is closed and merged jobs: - build: + build: # Always build... runs-on: ubuntu-latest steps: diff --git a/.github/workflows/commit.yml b/.github/workflows/commit.yml deleted file mode 100644 index 28860cb34..000000000 --- a/.github/workflows/commit.yml +++ /dev/null @@ -1,28 +0,0 @@ -# This workflow will build a Java project with Ant -# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-ant - -name: PR Build - -on: - pull_request: - branches: [ master, develop ] - types: [assigned, opened, synchronize, reopened] - - -jobs: - build: - if: github.event.pull_request.merged == false - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - name: Set up JDK 11 - uses: actions/setup-java@v2 - with: - java-version: '11' - distribution: 'adopt' - - name: Build with Ant - uses: GabrielBB/xvfb-action@v1 - with: - working-directory: ./build/ant - run: ant -noinput -buildfile build.xml diff --git a/.github/workflows/master_merge.yml b/.github/workflows/master_merge.yml deleted file mode 100644 index ee039edbc..000000000 --- a/.github/workflows/master_merge.yml +++ /dev/null @@ -1,35 +0,0 @@ -# This workflow will build a Java project with Ant -# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-ant - -name: Master Build - -on: - pull_request: - branches: [ master ] - types: [ closed ] - -jobs: - deploy: - if: ${{ github.event.pull_request.merged }} - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - name: Set up JDK 11 - uses: actions/setup-java@v2 - with: - java-version: '11' - distribution: 'adopt' - - name: Build with Ant - uses: GabrielBB/xvfb-action@v1 - with: - working-directory: ./build/ant - run: | - ant -noinput -buildfile build.xml - - name: Deploy files - shell: bash - run: | - /usr/bin/chmod +x ./build/publish-artifacts.sh - /usr/bin/bash ./build/publish-artifacts.sh - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From e74559e3e1eaa0a75c803fd8c16ce58c5ad342c3 Mon Sep 17 00:00:00 2001 From: Steffen Zschaler Date: Thu, 27 Mar 2025 15:52:36 +0000 Subject: [PATCH 4/7] Add debug statement to deploy step --- .github/workflows/ci-cd.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci-cd.yml b/.github/workflows/ci-cd.yml index 402b2c0ff..0dd0e7dd8 100644 --- a/.github/workflows/ci-cd.yml +++ b/.github/workflows/ci-cd.yml @@ -34,6 +34,7 @@ jobs: - name: Deploy files shell: bash run: | + pwd /usr/bin/chmod +x ./build/publish-artifacts.sh /usr/bin/bash ./build/publish-artifacts.sh # run: echo "Would deploy at this point..." From 19e77c479b2355cffd2c5d85732f5b655e79f137 Mon Sep 17 00:00:00 2001 From: Steffen Zschaler Date: Thu, 27 Mar 2025 17:08:03 +0000 Subject: [PATCH 5/7] Fully separted jobs for merge and non-merge case Because jobs cannot share files via workspace --- .github/workflows/ci-cd.yml | 37 ++++++++++++++++++++++++++----------- 1 file changed, 26 insertions(+), 11 deletions(-) diff --git a/.github/workflows/ci-cd.yml b/.github/workflows/ci-cd.yml index 0dd0e7dd8..7909d4e8f 100644 --- a/.github/workflows/ci-cd.yml +++ b/.github/workflows/ci-cd.yml @@ -7,7 +7,8 @@ on: types: [assigned, opened, synchronize, reopened, closed ] # Run when there are updates to the code in the PR or when the PR is closed and merged jobs: - build: # Always build... + build: # Only build when not merging + if: ${{ !github.event.pull_request.merged }} runs-on: ubuntu-latest steps: @@ -25,18 +26,32 @@ jobs: ant -noinput -buildfile build.xml deploy: - needs: build # Temporarily removing the condition, so can test... + # # Build and deploy when merging + # # Needs to be in a full action because file workspace isn't shared between jobs # if: ${{ github.event.pull_request.merged }} runs-on: ubuntu-latest steps: - - name: Deploy files - shell: bash - run: | - pwd - /usr/bin/chmod +x ./build/publish-artifacts.sh - /usr/bin/bash ./build/publish-artifacts.sh - # run: echo "Would deploy at this point..." - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - uses: actions/checkout@v2 + - name: Set up JDK 11 + uses: actions/setup-java@v2 + with: + java-version: '11' + distribution: 'adopt' + - name: Build with Ant + uses: GabrielBB/xvfb-action@v1 + with: + working-directory: ./build/ant + run: | + ant -noinput -buildfile build.xml + - name: Deploy files + shell: bash + run: | + pwd + ls -al + /usr/bin/chmod +x ./build/publish-artifacts.sh + /usr/bin/bash ./build/publish-artifacts.sh + # run: echo "Would deploy at this point..." + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From f57c9fd9d0717a5904d5bd532e778a688ca3e7f5 Mon Sep 17 00:00:00 2001 From: Steffen Zschaler Date: Thu, 27 Mar 2025 17:19:14 +0000 Subject: [PATCH 6/7] Debug statements removed --- .github/workflows/ci-cd.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/ci-cd.yml b/.github/workflows/ci-cd.yml index 7909d4e8f..913be00ca 100644 --- a/.github/workflows/ci-cd.yml +++ b/.github/workflows/ci-cd.yml @@ -48,8 +48,6 @@ jobs: - name: Deploy files shell: bash run: | - pwd - ls -al /usr/bin/chmod +x ./build/publish-artifacts.sh /usr/bin/bash ./build/publish-artifacts.sh # run: echo "Would deploy at this point..." From cafc62bb8824cc392d3048058c76f1ac64afb010 Mon Sep 17 00:00:00 2001 From: Steffen Zschaler Date: Thu, 27 Mar 2025 19:26:51 +0000 Subject: [PATCH 7/7] Clean up action code and bring back the conditions --- .github/workflows/ci-cd.yml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci-cd.yml b/.github/workflows/ci-cd.yml index 913be00ca..9645b5676 100644 --- a/.github/workflows/ci-cd.yml +++ b/.github/workflows/ci-cd.yml @@ -26,10 +26,9 @@ jobs: ant -noinput -buildfile build.xml deploy: - # Temporarily removing the condition, so can test... - # # Build and deploy when merging - # # Needs to be in a full action because file workspace isn't shared between jobs - # if: ${{ github.event.pull_request.merged }} + # Build and deploy when merging + # Needs to be in a full job because file workspace isn't shared between jobs, so cannot easily refactor + if: ${{ github.event.pull_request.merged }} runs-on: ubuntu-latest steps: @@ -50,6 +49,5 @@ jobs: run: | /usr/bin/chmod +x ./build/publish-artifacts.sh /usr/bin/bash ./build/publish-artifacts.sh - # run: echo "Would deploy at this point..." env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}