Add readme and license #2
This file contains hidden or 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: | |
| branches: | |
| - main # or your default branch | |
| jobs: | |
| autotag: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v3 | |
| - name: Fetch all tags | |
| run: git fetch --tags | |
| - name: Get latest tag | |
| id: get_tag | |
| run: | | |
| latest=$(git describe --tags `git rev-list --tags --max-count=1`) | |
| echo "Latest tag: $latest" | |
| echo "tag=$latest" >> $GITHUB_OUTPUT | |
| - name: Bump patch version | |
| id: bump | |
| run: | | |
| tag=${{ steps.get_tag.outputs.tag }} | |
| if [[ -z "$tag" ]]; then | |
| echo "tag=v0.0.0" >> $GITHUB_ENV | |
| else | |
| echo "tag=$tag" >> $GITHUB_ENV | |
| fi | |
| IFS='.' read -r major minor patch <<<"${tag#v}" | |
| patch=$((patch + 1)) | |
| new_tag="v$major.$minor.$patch" | |
| echo "new_tag=$new_tag" >> $GITHUB_OUTPUT | |
| - name: Create new tag | |
| run: | | |
| git config user.name "github-actions" | |
| git config user.email "github-actions@github.com" | |
| git tag ${{ steps.bump.outputs.new_tag }} | |
| git push origin ${{ steps.bump.outputs.new_tag }} | |