release: 0.0.36 #5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Auto Tag | ||
on: [push] | ||
permissions: | ||
contents: write | ||
jobs: | ||
tag: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
# parse version from git log like `release: 0.0.35` | ||
- name: Get version | ||
id: version | ||
run: echo VERSION=$(git log --pretty=oneline -1 | grep -oP 'release: \K[0-9.]+') >> $GITHUB_ENV | ||
# skip if no version found | ||
- name: Check version | ||
run: echo "Version: $VERSION" | ||
- name: Skip if no version | ||
if: $VERSION == '' | ||
run: echo "No version found, skipping..." | ||
# create & push tag | ||
- name: Create & push tag | ||
if: $VERSION != '' | ||
run: | | ||
git tag v$VERSION | ||
git push origin v$VERSION |