From 4cdef0b2dbe0c9aa26bed48edb868db738625e79 Mon Sep 17 00:00:00 2001 From: James Kessler Date: Wed, 16 Oct 2024 16:35:46 -0400 Subject: [PATCH] Always point the major version tag to the latest release (#230) * Add a workflow to always point the major version tag to the latest release. --- .../workflows/update-major-version-tag.yml | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 .github/workflows/update-major-version-tag.yml diff --git a/.github/workflows/update-major-version-tag.yml b/.github/workflows/update-major-version-tag.yml new file mode 100644 index 00000000..0d9ca810 --- /dev/null +++ b/.github/workflows/update-major-version-tag.yml @@ -0,0 +1,26 @@ +name: Update Major Version Tag + +on: + release: + types: [published] + +jobs: + update-major-version-tag: + runs-on: ubuntu-latest + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + + - name: Extract Major Version + id: extract_major_version + run: | + # Extract the major version part (e.g., "v2" from "v2.3.1") + echo "release_tag=${{ github.event.release.tag_name }}" >> $GITHUB_ENV + major_version=$(echo "${{ github.event.release.tag_name }}" | grep -oE "^v[0-9]+") + echo "major_version=$major_version" >> $GITHUB_ENV + + - name: Update Major Version Tag + run: | + git fetch --tags + git tag -f ${{ env.major_version }} ${{ github.event.release.tag_name }} + git push origin ${{ env.major_version }} --force