Skip to content

Commit

Permalink
Create tag.yml
Browse files Browse the repository at this point in the history
Auto tag merges
  • Loading branch information
Gyarbij authored Jun 22, 2024
1 parent 85116c3 commit f16c41f
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/tag.yml
Original file line number Diff line number Diff line change
@@ -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 "[email protected]"
git config --local user.name "GitHub Actions"
git tag ${{ env.VERSION }}
git push origin ${{ env.VERSION }}

0 comments on commit f16c41f

Please sign in to comment.