fix: tag ci (#15) #2
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: Tag on Version Change | |
on: | |
push: | |
branches: | |
- master | |
workflow_dispatch: | |
jobs: | |
tag: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-tags: true | |
- name: Check Version | |
id: check_version | |
run: | | |
if [[ -f VERSION ]]; then | |
version=$(cat VERSION) | |
tags=$(git tag --list) | |
if [[ ! "$tags" =~ (^|[[:space:]])"$version"($|[[:space:]]) ]]; then | |
echo "::set-output name=tag::$version" | |
fi | |
fi | |
- name: Create Tag | |
if: steps.check_version.outputs.tag | |
run: | | |
git tag ${{ steps.check_version.outputs.tag }} | |
git push origin ${{ steps.check_version.outputs.tag }} |