Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(snapshot workflow): Allow snapshots from bugfix branches #1558

Merged
merged 4 commits into from
Sep 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading