Skip to content

Update new-tag.yml

Update new-tag.yml #2

Workflow file for this run

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@v4
- 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