.github/workflows/release.yaml
---
name: release
on:
push:
tags:
- v[0-9]+.[0-9]+.[0-9]+
permissions:
contents: write
concurrency:
group: ${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}
cancel-in-progress: true
jobs:
release:
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4
- name: Fetch all tags
run: git fetch --force --tags
- name: Cleanup pre-release tags
run: git tag -l | grep -E "v[0-9]+.[0-9]+.[0-9]+-(alpha|beta|rc).[0-9]+" | xargs git tag -d
- name: Setup Golang
uses: actions/setup-go@v5
with:
go-version: ^1.22.7
- name: Setup workspace
run: cp go.work.dist go.work
- name: Log in to Docker Hub
if: ${{ !contains(github.ref_name, '-') }}
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Run GoReleaser for release
uses: goreleaser/goreleaser-action@v6
with:
distribution: goreleaser
version: 2.3.1
args: release --verbose --clean
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
GO_VERSION: 1.22.7