From c963d9924299a86ec81c33594a8e2216984f970b Mon Sep 17 00:00:00 2001 From: Jan Boonen Date: Wed, 8 Oct 2025 22:49:46 +0200 Subject: [PATCH 1/2] fix(ci/cd): fix bug in Release Workflow Add debug information (echo command) to get insights in run-ids of workflows. Added a workflow to test downloading of artifacts in a pull request. --- .../actions/prepare_maven_build/action.yml | 7 +-- .github/workflows/01-build.yml | 2 +- .github/workflows/04-release.yml | 3 ++ .github/workflows/99-workflow_test.yml | 54 +++++++++++++++++++ 4 files changed, 62 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/99-workflow_test.yml diff --git a/.github/actions/prepare_maven_build/action.yml b/.github/actions/prepare_maven_build/action.yml index 8e6e7b1..3ccf6f5 100644 --- a/.github/actions/prepare_maven_build/action.yml +++ b/.github/actions/prepare_maven_build/action.yml @@ -45,8 +45,9 @@ runs: echo "GITHUB_EVENT_NAME: $GITHUB_EVENT_NAME" echo "GITHUB_REF: $GITHUB_REF" echo "GITHUB_SHA: $GITHUB_SHA" - echo "GITHUB_JOB: $GITHUB_JOB" # reference the default environment variables + echo "GITHUB_WORKFLOW: $GITHUB_WORKFLOW" + echo "GITHUB_WORKFLOW_REF: $GITHUB_WORKFLOW_REF" + echo "GITHUB_JOB: $GITHUB_JOB" echo "GITHUB_RUN_ID: $GITHUB_RUN_ID" echo "GITHUB_ACTOR: $GITHUB_ACTOR" - echo "WORKFLOW_RUN_ID: ${{ github.event.workflow_run.id }}" - echo "WORKFLOW_RUN_CONCLUSION: ${{ github.event.workflow_run.conclusion }}" + echo "GITHUB_TRIGGERING_ACTOR: $GITHUB_TRIGGERING_ACTOR" diff --git a/.github/workflows/01-build.yml b/.github/workflows/01-build.yml index 61cf024..199289b 100644 --- a/.github/workflows/01-build.yml +++ b/.github/workflows/01-build.yml @@ -12,7 +12,7 @@ on: outputs: run-id: description: - value: ${{ jobs.build.outputs.run-id }} + value: ${{ jobs.compile.outputs.run-id }} jobs: compile: diff --git a/.github/workflows/04-release.yml b/.github/workflows/04-release.yml index 7f13418..8c48e2c 100644 --- a/.github/workflows/04-release.yml +++ b/.github/workflows/04-release.yml @@ -60,6 +60,9 @@ jobs: steps: - uses: actions/checkout@v4 - uses: ./.github/actions/prepare_maven_build + - name: Debug output of Build workflow + run: | + echo "Run-id of compile step: ${{ needs.build.outputs.run-id }}" - name: Verify non-snapshot version run: | VERSION="${{ needs.preflight.outputs.VERSION }}" diff --git a/.github/workflows/99-workflow_test.yml b/.github/workflows/99-workflow_test.yml new file mode 100644 index 0000000..ddea78d --- /dev/null +++ b/.github/workflows/99-workflow_test.yml @@ -0,0 +1,54 @@ +name: Release + +on: + push: + branches: + - "feature/*" + +permissions: + contents: write + packages: write + pull-requests: write + +jobs: + preflight: + runs-on: ubuntu-latest + outputs: + VERSION: ${{ steps.read_version.outputs.version }} + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - uses: ./.github/actions/prepare_maven_build + - name: Read version from pom.xml + id: read_version + run: echo "version=$(mvn -q -DforceStdout -Dchangelist= -Dexpression=project.version help:evaluate)" >> "$GITHUB_OUTPUT" + + build: + needs: preflight + uses: ./.github/workflows/01-build.yml + secrets: + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + + release: + needs: [preflight, build] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: ./.github/actions/prepare_maven_build + - name: Debug output of Build workflow + run: | + echo "Run-id of compile step: ${{ needs.build.outputs.run-id }}" + - uses: ./.github/actions/download_intermediate_artifacts + - name: Verify non-snapshot version + run: | + VERSION="${{ needs.preflight.outputs.VERSION }}" + if [[ "$VERSION" == *"-SNAPSHOT" ]]; then + echo "This workflow must deploy a non-snapshot version. Current version is: $VERSION" + exit 1 + fi + - uses: ./.github/actions/download_intermediate_artifacts + - name: Deploy release artifacts (GitHub Packages) + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: mvn ${MAVEN_CLI_OPTS} -Dchangelist= -DskipTests package From f549e2901ed56f78d6255ed8dbfe50b93680e065 Mon Sep 17 00:00:00 2001 From: Jan Boonen Date: Thu, 9 Oct 2025 20:22:55 +0200 Subject: [PATCH 2/2] fix(ci/cd): delete test workflow --- .github/workflows/99-workflow_test.yml | 54 -------------------------- 1 file changed, 54 deletions(-) delete mode 100644 .github/workflows/99-workflow_test.yml diff --git a/.github/workflows/99-workflow_test.yml b/.github/workflows/99-workflow_test.yml deleted file mode 100644 index ddea78d..0000000 --- a/.github/workflows/99-workflow_test.yml +++ /dev/null @@ -1,54 +0,0 @@ -name: Release - -on: - push: - branches: - - "feature/*" - -permissions: - contents: write - packages: write - pull-requests: write - -jobs: - preflight: - runs-on: ubuntu-latest - outputs: - VERSION: ${{ steps.read_version.outputs.version }} - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - uses: ./.github/actions/prepare_maven_build - - name: Read version from pom.xml - id: read_version - run: echo "version=$(mvn -q -DforceStdout -Dchangelist= -Dexpression=project.version help:evaluate)" >> "$GITHUB_OUTPUT" - - build: - needs: preflight - uses: ./.github/workflows/01-build.yml - secrets: - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - - release: - needs: [preflight, build] - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: ./.github/actions/prepare_maven_build - - name: Debug output of Build workflow - run: | - echo "Run-id of compile step: ${{ needs.build.outputs.run-id }}" - - uses: ./.github/actions/download_intermediate_artifacts - - name: Verify non-snapshot version - run: | - VERSION="${{ needs.preflight.outputs.VERSION }}" - if [[ "$VERSION" == *"-SNAPSHOT" ]]; then - echo "This workflow must deploy a non-snapshot version. Current version is: $VERSION" - exit 1 - fi - - uses: ./.github/actions/download_intermediate_artifacts - - name: Deploy release artifacts (GitHub Packages) - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: mvn ${MAVEN_CLI_OPTS} -Dchangelist= -DskipTests package