Release #3
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: Release | |
on: | |
release: | |
types: [published] | |
workflow_dispatch: | |
inputs: | |
tag: | |
description: "Tag to release (e.g. v0.0.1)" | |
required: true | |
skip_publish: | |
description: "Skip binary publish" | |
required: false | |
default: "false" | |
skip_docker: | |
description: "Skip docker publish" | |
required: false | |
default: "false" | |
skip_homebrew: | |
description: "Skip homebrew publish" | |
required: false | |
default: "false" | |
skip_validate: | |
description: "Skip GoReleaser validation" | |
required: false | |
default: "false" | |
permissions: | |
contents: write | |
jobs: | |
goreleaser: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
with: | |
fetch-depth: 0 | |
- name: Checkout release tag | |
run: | | |
git fetch --tags | |
TAG="${{ github.event.release.tag_name || github.event.inputs.tag }}" | |
if [ -z "$TAG" ]; then | |
echo "Error: No tag provided in release event or workflow_dispatch input" | |
exit 1 | |
fi | |
echo "Checking out tag $TAG" | |
git checkout "$TAG" | |
- name: Set up Go (from go.mod) | |
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0 | |
with: | |
go-version-file: go.mod | |
# Setup QEMU, buildx and login to DockerHub, required for GoReleaser | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392 # v3.6.0 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1 | |
- name: Login to DockerHub | |
uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4.0 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Run GoReleaser | |
uses: goreleaser/goreleaser-action@9c156ee8a17a598857849441385a2041ef570552 # v6.3.0 | |
with: | |
distribution: goreleaser | |
version: latest | |
args: > | |
release --clean | |
${{ github.event.inputs.skip_publish == 'true' && ' --skip publish' || '' }} | |
${{ github.event.inputs.skip_validate == 'true' && ' --skip validate' || '' }} | |
${{ github.event.inputs.skip_docker == 'true' && ' --skip docker' || '' }} | |
${{ github.event.inputs.skip_homebrew == 'true' && ' --skip homebrew' || '' }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
HOMEBREW_TAP_GITHUB_TOKEN: ${{ secrets.HOMEBREW_TAP_GITHUB_TOKEN }} |