Skip to content

Commit

Permalink
fix get-version-from-release-branch-reusable.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
friedrichwilken committed Feb 8, 2024
1 parent 5c71398 commit 76254ab
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions .github/workflows/get-version-from-release-branch-reusable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,15 @@ jobs:
MINOR: ${{ env.MINOR }}
run: |
TAGS=$(git tag -l "$MAJOR.$MINOR.*")
if [[ -z $TAGS ]]; then
PATCH=0
if [[ -n $TAGS ]]; then
# -n tests for a non-zero-length string
LAST_PATCH=$(echo "$TAGS" | cut -d '.' -f 3 | sort -n | tail -n 1)
PATCH=$((LAST_PATCH + 1))
else
PATCH=$(( $(echo $TAGS | cut -d '.' -f 3 | sort -n | tail -n 1) + 1))
# If TAGS is empty, PATCH defaults to 0
PATCH=0
fi
VERSION="${MAJOR}.${MINOR}.${PATCH:-0}"
VERSION="${MAJOR}.${MINOR}.${PATCH}"
echo "version: ${VERSION}"
echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT
exit 0

0 comments on commit 76254ab

Please sign in to comment.