goreleaser
GoReleaser Skill
GoReleaser automates the release process for software projects. It builds binaries, creates archives, publishes to package managers, builds Docker images, and generates changelogs.
Quick Reference
| Task | Reference File |
|---|---|
| Build configuration | references/builds.md |
| Archives (tar.gz, zip) | references/archives.md |
| Docker images | references/docker.md |
| Linux packages (deb/rpm) | references/nfpm.md |
| Homebrew/Scoop/AUR | references/homebrew.md |
| Signing & notarization | references/signing.md |
| Changelog generation | references/changelog.md |
| CI/CD integration | references/ci.md |
| release-please integration | ../release-please/references/release-please-goreleaser-unified-workflow.md |
| Template variables | references/templates.md |
| Complete examples | references/examples.md |
Essential Commands
# Initialize new config
goreleaser init
# Validate configuration
goreleaser check
# Test build locally (no publish)
goreleaser release --snapshot --clean
# Create release (usually run in CI)
goreleaser release
Configuration File
GoReleaser uses .goreleaser.yaml (or .goreleaser.yml). Enable schema validation:
# yaml-language-server: $schema=https://goreleaser.com/static/schema.json
version: 2
# Project name (defaults to directory name)
project_name: myapp
Minimal Go Configuration
# yaml-language-server: $schema=https://goreleaser.com/static/schema.json
version: 2
builds:
- main: ./cmd/myapp
binary: myapp
goos: [linux, darwin, windows]
goarch: [amd64, arm64]
ldflags:
- -s -w
- -X main.version={{.Version}}
archives:
- formats: [tar.gz]
format_overrides:
- goos: windows
formats: [zip]
changelog:
sort: asc
filters:
exclude:
- "^docs:"
- "^test:"
Build Targets
Go (default)
builds:
- builder: go # optional, default
main: ./cmd/app
goos: [linux, darwin, windows]
goarch: [amd64, arm64]
goarm: ["6", "7"] # for ARM builds
Rust
builds:
- builder: rust
targets:
- x86_64-unknown-linux-gnu
- x86_64-apple-darwin
- aarch64-apple-darwin
Zig
builds:
- builder: zig
targets:
- x86_64-linux-gnu
- x86_64-macos
- aarch64-macos
Prebuilt Binaries
builds:
- builder: prebuilt
prebuilt:
path: dist/myapp_{{ .Os }}_{{ .Arch }}/myapp{{ .Ext }}
Common Patterns
Version Injection (Go)
builds:
- ldflags:
- -X main.version={{.Version}}
- -X main.commit={{.Commit}}
- -X main.date={{.Date}}
CGO Disabled
builds:
- env:
- CGO_ENABLED=0
Multiple Binaries
builds:
- id: cli
main: ./cmd/cli
binary: myapp
- id: server
main: ./cmd/server
binary: myapp-server
Publishing
Homebrew Tap
brews:
- repository:
owner: myorg
name: homebrew-tap
homepage: https://example.com
description: "My application"
Docker Images
dockers_v2:
- dockerfile: Dockerfile
images:
- "ghcr.io/myorg/myapp:{{ .Tag }}"
- "ghcr.io/myorg/myapp:latest"
GitHub Release
release:
github:
owner: myorg
name: myrepo
draft: false
prerelease: auto
Environment Variables
| Variable | Purpose |
|---|---|
GITHUB_TOKEN |
GitHub API access |
GITLAB_TOKEN |
GitLab API access |
GITEA_TOKEN |
Gitea API access |
GORELEASER_KEY |
Pro license key |
Workflow
- Initialize:
goreleaser initcreates.goreleaser.yaml - Configure: Edit config for your needs (see reference files)
- Validate:
goreleaser checkverifies configuration - Test:
goreleaser release --snapshot --cleantests locally - Release: Tag and push, CI runs
goreleaser release
release-please Integration Rule
When a project uses both release-please and GoReleaser, always implement them in a unified workflow (same workflow file) instead of separate chained workflows.
Use ../release-please/references/release-please-goreleaser-unified-workflow.md as the canonical integration recipe.
- Run
googleapis/release-please-action@v4first. - Use its outputs (
release_created,tag_name) to conditionally run GoReleaser. - Checkout
ref: ${{ needs.release-please.outputs.tag_name }}beforegoreleaser release --clean. - Use
GITHUB_TOKENand avoid introducing a custom PAT just to trigger GoReleaser.
This avoids GitHub Actions token recursion issues and removes the need for release-trigger PAT workarounds.
When to Load References
- Setting up builds: Load
references/builds.mdfor complete build options - Configuring Docker: Load
references/docker.mdfor multi-arch images - Linux packages: Load
references/nfpm.mdfor deb/rpm/apk packages - Package managers: Load
references/homebrew.mdfor Homebrew/Scoop/AUR/etc. - CI setup: Load
references/ci.mdfor GitHub Actions/GitLab CI - release-please integration: Load
../release-please/references/release-please-goreleaser-unified-workflow.mdfor the unified no-custom-PAT workflow - Template syntax: Load
references/templates.mdfor available variables - Complete examples: Load
references/examples.mdfor copy-paste configs
More from aaronflorey/agent-skills
amber-lang
Write, debug, and explain Amber code, the `amber` language that compiles `.ab` files to Bash. Use this skill when the user asks to write an Amber script, convert Bash to Amber, compile Amber to Bash, debug Amber syntax or type errors, or asks about Amber 0.5.1-alpha syntax, functions, types, error handling, the standard library, or the `amber` CLI.
26go-cobra
Write, scaffold, and debug Go CLI applications with `github.com/spf13/cobra`. Use this skill whenever the user mentions Cobra, `cobra.Command`, a Go command-line app, subcommands, persistent or local flags, required flags, argument validation, shell completions, generated docs, or wants to build or refactor a cobra-based CLI.
24laravel-actions
Write, scaffold, explain, and refactor code using the `lorisleiva/laravel-actions` package. Use this skill whenever the user mentions Laravel Actions, `AsAction`, `php artisan make:action`, action classes, converting a controller, job, listener, or command into an action, dispatching an action as a job, using an action as a controller or listener, or adding validation, authorization, testing, or mocking around an action.
24num30-config
Write, debug, and explain Go configuration code using `github.com/num30/config`. Use this skill when the user mentions `num30/config`, wants config structs, file plus env plus CLI flag loading, validation, config watching, precedence rules, or asks how to integrate the num30/config package into a Go application.
22pelican-panel-plugins
Write, scaffold, explain, and debug plugins for the Pelican gaming panel. Use this skill whenever the user mentions Pelican plugins, extending Pelican, FilamentPHP resources or pages for Pelican, plugin service providers, custom permissions, plugin settings, routes, models, widgets, or asks how to add new functionality to the Pelican panel.
21go-viper
Write, debug, and explain Go configuration code with `github.com/spf13/viper`. Use this skill whenever the user mentions Viper, `viper`, config structs, reading config from files plus env vars plus flags, Cobra or `pflag` integration, unmarshaling into structs, env key replacers, config precedence, config watching, or a clean Viper bootstrap.
20