Skip to content

Commit

Permalink
feat(snapshot workflow): Allow snapshots from bugfix branches (#1558)
Browse files Browse the repository at this point in the history
* Refactor determine-version job

* Removed unnecessary bits

* typo

* remove release branch
  • Loading branch information
rafaelmag110 authored Sep 17, 2024
1 parent 61d1670 commit b8db9bf
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 16 deletions.
17 changes: 8 additions & 9 deletions .github/workflows/publish-new-snapshot.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 }}
Expand All @@ -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:
Expand All @@ -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:
Expand Down
8 changes: 1 addition & 7 deletions .github/workflows/run-all-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down

0 comments on commit b8db9bf

Please sign in to comment.