From ecc5b6bc59fb3e8410ad6edccb8ad0a2adc128bc Mon Sep 17 00:00:00 2001 From: Caio Ricciuti Date: Sat, 1 Jun 2024 18:00:18 +0200 Subject: [PATCH] Patch release workflow --- .github/workflows/release.yml | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d29335d..b7ccb0a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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 @@ -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