From f16c41fa3f032967eeeb4cab0ddf5aeeda874fef Mon Sep 17 00:00:00 2001 From: Chono N <49493993+Gyarbij@users.noreply.github.com> Date: Sun, 23 Jun 2024 01:55:20 +0200 Subject: [PATCH] Create tag.yml Auto tag merges --- .github/workflows/tag.yml | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 .github/workflows/tag.yml diff --git a/.github/workflows/tag.yml b/.github/workflows/tag.yml new file mode 100644 index 0000000..31977e8 --- /dev/null +++ b/.github/workflows/tag.yml @@ -0,0 +1,36 @@ +name: Auto Tag + +on: + push: + branches: + - main + +jobs: + tag: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Get last commit message + id: commit_message + run: echo "COMMIT_MESSAGE=$(git log -1 --pretty=%B)" >> $GITHUB_ENV + + - name: Extract version from branch name + id: extract_version + run: | + BRANCH_NAME=$(echo ${{ github.head_ref }} | sed 's/refs\/heads\///') + if [[ $BRANCH_NAME =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then + echo "VERSION=$BRANCH_NAME" >> $GITHUB_ENV + else + echo "VERSION=" >> $GITHUB_ENV + fi + + - name: Create and push tag + if: env.VERSION != '' + run: | + git config --local user.email "actions@github.com" + git config --local user.name "GitHub Actions" + git tag ${{ env.VERSION }} + git push origin ${{ env.VERSION }}