From b8db9bf046bf6819f54ba5dfdef928ec98414b5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Magalh=C3=A3es?= Date: Tue, 17 Sep 2024 13:39:38 +0100 Subject: [PATCH] feat(snapshot workflow): Allow snapshots from bugfix branches (#1558) * Refactor determine-version job * Removed unnecessary bits * typo * remove release branch --- .github/workflows/publish-new-snapshot.yaml | 17 ++++++++--------- .github/workflows/run-all-tests.yml | 8 +------- 2 files changed, 9 insertions(+), 16 deletions(-) diff --git a/.github/workflows/publish-new-snapshot.yaml b/.github/workflows/publish-new-snapshot.yaml index 49e3d7861..fda164daf 100644 --- a/.github/workflows/publish-new-snapshot.yaml +++ b/.github/workflows/publish-new-snapshot.yaml @@ -23,20 +23,16 @@ --- name: "Publish new snapshot" +run-name: "Publish new snapshot from ${{github.ref_name}}" on: workflow_run: workflows: [ "Run-All-Tests" ] branches: - main - - releases - - release/* - - hotfix/* + - bugfix/* types: - completed - release: - types: - - published workflow_dispatch: # periodic build triggers are defined in run-all-tests.yml, which triggers this workflow @@ -68,6 +64,7 @@ jobs: exit 0 determine-version: + name: "Determine snapshot version to be published" runs-on: ubuntu-latest outputs: VERSION: ${{ steps.get-version.outputs.VERSION }} @@ -77,10 +74,12 @@ jobs: id: get-version run: | - # only create the version string if the run-all-tests workflow was triggered by a cron event + IFS=.- read -r RELEASE_VERSION_MAJOR RELEASE_VERSION_MINOR RELEASE_VERSION_PATCH SNAPSHOT<<<$(grep "version" gradle.properties | awk -F= '{print $2}') if [[ ${{ github.event.workflow_run.event }} == "schedule" ]]; then - echo "VERSION=$(IFS=.- read -r RELEASE_VERSION_MAJOR RELEASE_VERSION_MINOR RELEASE_VERSION_PATCH SNAPSHOT<<<$(grep "version" gradle.properties | awk -F= '{print $2}') && echo $RELEASE_VERSION_MAJOR.$RELEASE_VERSION_MINOR.$RELEASE_VERSION_PATCH-$(date +"%Y%m%d")-SNAPSHOT)" >> "$GITHUB_OUTPUT" + echo "VERSION=$RELEASE_VERSION_MAJOR.$RELEASE_VERSION_MINOR.$RELEASE_VERSION_PATCH-$(date +"%Y%m%d")-SNAPSHOT" >> "$GITHUB_OUTPUT" + else + echo "VERSION=$RELEASE_VERSION_MAJOR.$RELEASE_VERSION_MINOR.$RELEASE_VERSION_PATCH-SNAPSHOT" >> "$GITHUB_OUTPUT" fi publish-docker-images: @@ -104,7 +103,7 @@ jobs: # do not run on PR branches, do not run on releases if: | - needs.secret-presence.outputs.HAS_OSSRH && github.event_name != 'pull_request' && github.ref != 'refs/heads/releases' + needs.secret-presence.outputs.HAS_OSSRH uses: ./.github/workflows/trigger-maven-publish.yaml secrets: inherit with: diff --git a/.github/workflows/run-all-tests.yml b/.github/workflows/run-all-tests.yml index 9b6843b86..d993922f4 100644 --- a/.github/workflows/run-all-tests.yml +++ b/.github/workflows/run-all-tests.yml @@ -27,13 +27,7 @@ on: push: branches: - main - - releases - - previews/* - tags: - - '[0-9]+.[0-9]+.[0-9]+' - release: - types: - - published + - bugfix/* pull_request: workflow_dispatch: