Skip to content

Update auto-tag.yml

Update auto-tag.yml #3

Workflow file for this run

name: Auto Tag & Release
on:
push:
branches:
- master
permissions:
contents: write
jobs:
tag-and-release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Bump patch version and push tag
id: tag
run: |
LATEST=$(git tag -l 'v*' --sort=-v:refname | head -n1)
if [ -z "$LATEST" ]; then
NEW="v0.1.0"
else
MAJOR=$(echo "$LATEST" | cut -d. -f1)
MINOR=$(echo "$LATEST" | cut -d. -f2)
PATCH=$(echo "$LATEST" | cut -d. -f3)
PATCH=$((PATCH + 1))
NEW="${MAJOR}.${MINOR}.${PATCH}"
fi
echo "Tagging $NEW"
git tag "$NEW"
git push origin "$NEW"
echo "tag=$NEW" >> "$GITHUB_OUTPUT"
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6
with:
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GORELEASER_CURRENT_TAG: ${{ steps.tag.outputs.tag }}