From 66af71dbefbf93e029e61fa256b2c1efc9c66374 Mon Sep 17 00:00:00 2001 From: HassanBahati Date: Sun, 17 Nov 2024 18:04:42 +0300 Subject: [PATCH] feat: enable shorthand vX tags inheritted from major latest version --- .github/workflows/release-tag.yaml | 33 ++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 .github/workflows/release-tag.yaml diff --git a/.github/workflows/release-tag.yaml b/.github/workflows/release-tag.yaml new file mode 100644 index 0000000..dedd9ea --- /dev/null +++ b/.github/workflows/release-tag.yaml @@ -0,0 +1,33 @@ +name: Release and Tag Management + +on: + release: + types: [published] + +jobs: + update-major-version-tag: + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Get major version + id: get_version + run: | + VERSION=${GITHUB_REF#refs/tags/v} + MAJOR_VERSION=v${VERSION%%.*} + echo "major_version=${MAJOR_VERSION}" >> $GITHUB_OUTPUT + echo "full_version=v${VERSION}" >> $GITHUB_OUTPUT + + - name: Update major version tag + run: | + git config user.name "github-actions[bot]" + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" + git tag -fa ${{ steps.get_version.outputs.major_version }} -m "Update major version tag to ${{ steps.get_version.outputs.full_version }}" + git push origin ${{ steps.get_version.outputs.major_version }} --force + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}