Skip to content

Commit

Permalink
Patch release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
caioricciuti committed Jun 1, 2024
1 parent db87716 commit ecc5b6b
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ jobs:
run: |
set -e # Fail on first error
# Extract the latest tag, or default to v1.0.0 if no tags exist
latest_tag=$(git describe --tags --abbrev=0 2>/dev/null)
# Extract the latest tag
latest_tag=$(git describe --tags --abbrev=0)
echo "Latest tag: $latest_tag"
echo "latest_tag=$latest_tag" >> $GITHUB_ENV
Expand All @@ -45,11 +45,16 @@ jobs:
run: |
set -e # Fail on first error
while git rev-parse "refs/tags/${{ env.new_tag }}" >/dev/null 2>&1; do
echo "Tag ${{ env.new_tag }} already exists."
new_tag="${{ env.new_tag }}"
while git rev-parse "refs/tags/${new_tag}" >/dev/null 2>&1; do
echo "Tag $new_tag already exists."
# Increment the patch version
new_patch=$((new_patch + 1))
IFS='.' read -r -a parts <<< "${new_tag//v/}"
major=${parts[0]}
minor=${parts[1]}
patch=${parts[2]}
new_patch=$((patch + 1))
new_tag="v$major.$minor.$new_patch"
echo "New incremented tag: $new_tag"
done
Expand Down

0 comments on commit ecc5b6b

Please sign in to comment.