GoReleaser and GitHub Actions

Updated

September 8, 2026

GoReleaser and GitHub Actions

Overview

Automate multi-OS binaries, checksums, and GitHub Releases with GoReleaser and a tag-driven workflow.

Minimal .goreleaser.yaml

version: 2
builds:
  - id: app
    main: ./cmd/app
    env: [CGO_ENABLED=0]
    goos: [linux, darwin, windows]
    goarch: [amd64, arm64]
    ldflags:
      - -s -w -X main.version={{.Version}} -X main.commit={{.Commit}}
archives:
  - formats: [tar.gz]
    format_overrides:
      - goos: windows
        formats: [zip]
checksum:
  name_template: checksums.txt

Workflow sketch

# .github/workflows/release.yml
on:
  push:
    tags: ["v*"]
jobs:
  release:
    runs-on: ubuntu-latest
    permissions:
      contents: write
    steps:
      - uses: actions/checkout@v4
        with: { fetch-depth: 0 }
      - uses: actions/setup-go@v5
        with: { go-version-file: go.mod }
      - uses: goreleaser/goreleaser-action@v6
        with:
          args: release --clean
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Local snapshot

goreleaser release --snapshot --clean

Rules of thumb

Do Don’t
Tag semver v1.2.3 Untagged mystery builds as “prod”
Pin action versions @master for release
Verify checksums Trust unsigned downloads blindly

Try next

  1. Snapshot release locally.
  2. Add version subcommand reading ldflags.
  3. Attach govulncheck job on PR.