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
24 changes: 22 additions & 2 deletions .github/workflows/bump-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ jobs:
id: latest
run: |
git fetch --tags
tag=$(git tag --sort=-v:refname | head -n 1)
tag=$(git tag --list "v*" \
| grep -Ev -- '-beta' \
| sort -V \
| tail -n 1)
echo "tag=${tag:-v0.0.0}" >> $GITHUB_OUTPUT

- name: Determine bump
Expand All @@ -53,6 +56,7 @@ jobs:
id: version
if: steps.bump.outputs.type != ''
run: |
BRANCH="${{ github.event.pull_request.base.ref }}"
v=${{ steps.latest.outputs.tag }}
v=${v#v}
IFS=. read major minor patch <<< "$v"
Expand All @@ -63,7 +67,23 @@ jobs:
patch) patch=$((patch+1)) ;;
esac

echo "next=v$major.$minor.$patch" >> $GITHUB_OUTPUT
BASE_VERSION="$major.$minor.$patch"

if [[ "$BRANCH" == "development" ]]; then
EXISTING=$(git tag -l "v$BASE_VERSION-beta*" | sort -V | tail -n 1)

if [[ -z "$EXISTING" ]]; then
NEXT="v$BASE_VERSION-beta.1"
else
NUM=$(echo "$EXISTING" | sed -E 's/.*beta\.?([0-9]*)/\1/')
NEXT="v$BASE_VERSION-beta.$((NUM+1))"
fi

else
NEXT="v$BASE_VERSION"
fi

echo "next=$NEXT" >> $GITHUB_OUTPUT

- name: Create and push tag
if: steps.bump.outputs.type != ''
Expand Down