Skip to content
Open
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
14 changes: 10 additions & 4 deletions template/.github/workflows/build.yaml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -151,12 +151,18 @@ jobs:

CURRENT_VERSION=$(cargo metadata --format-version 1 --no-deps | jq -r '.packages[] | select(.name == "stackable-{[ operator.name }]") | .version')

# Include a PR suffix if this workflow is triggered by a PR
if [ "$GITHUB_EVENT_NAME" == 'pull_request' ]; then
# Include a PR suffix if this workflow is triggered by a PR
if [ "$PR_BASE_REF" == 'main' ]; then
NEW_VERSION="0.0.0-pr$PR_NUMBER"
else
# If the PR is raised against a release branch, use the current operator version and
# append a suffix to it. If the PR is raised against ANY other base branch, use the
# established 0.0.0-prXXX tag.
if [[ "$PR_BASE_REF" =~ ^release-[0-9]{2}\.[0-9]{1,2}$ ]]; then
NEW_VERSION="$CURRENT_VERSION-pr$PR_NUMBER"
else
# NOTE (@Techassi): One could argue that we should warn the developer when the current
# version is not 0.0.0-dev (and the PR potentially doesn't target main) that we will
# still rewrite the version to 0.0.0-prXXX.
NEW_VERSION="0.0.0-pr$PR_NUMBER"
fi
else
# Just use the current version if this workflow is run on push, schedule, etc...
Expand Down