From 88a050ebecd06f60aea4950741d287ef548f2536 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=2E=20Gouv=C3=AAa?= <10741284+htrgouvea@users.noreply.github.com> Date: Wed, 25 Dec 2024 18:27:54 +0300 Subject: [PATCH] Create new-tag.yml --- .github/workflows/new-tag.yml | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 .github/workflows/new-tag.yml diff --git a/.github/workflows/new-tag.yml b/.github/workflows/new-tag.yml new file mode 100644 index 0000000..7eb13bb --- /dev/null +++ b/.github/workflows/new-tag.yml @@ -0,0 +1,34 @@ +name: Create Tag on Commit to Main + +on: + push: + branches: + - main + +jobs: + create_tag: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Set up Git + uses: actions/setup-git@v2 + + - name: Get the current version + id: version + run: | + VERSION=$(git describe --tags --abbrev=0) + echo "VERSION=$VERSION" >> $GITHUB_ENV + + - name: Create a new tag + run: | + NEW_VERSION=$(echo ${{ env.VERSION }} | awk -F. -v OFS=. '{$NF++;print}') + echo "New version: $NEW_VERSION" + git tag $NEW_VERSION + git push origin $NEW_VERSION + + - name: Push the tag to the repository + run: | + git push origin --tags