| name | goreleaser |
| description | Initialize or update GoReleaser configuration for automated Go releases with multi-architecture Docker builds, binary distribution, and Homebrew publishing |
GoReleaser Setup Skill
Automate Go project releases with cross-platform binaries, multi-architecture Docker images, and package distribution.
Overview
GoReleaser handles complete release automation for Go projects:
- Building binaries for multiple OS/architectures
- Creating multi-architecture Docker images and manifests
- Publishing to GitHub/GitLab releases
- Generating Homebrew formulas
- Creating automated changelogs
- Calculating checksums and signatures
This skill provides templates and guidance for professional release automation.
Prerequisites
- GoReleaser installed:
brew install goreleaser or see https://goreleaser.com/install/
- Docker with buildx: For multi-architecture builds (
docker buildx version)
- Git tags: GoReleaser works with semantic versioning tags (e.g.,
v1.0.0)
- GitHub/GitLab token: For release creation and Homebrew tap updates
- Project structure: Go module with
cmd/ directory (or adjust dir field)
Quick Start
Step 1: Analyze Project Structure
Understand your project:
ls -la .goreleaser.yml .goreleaser.yaml
find . -name "main.go" -type f
cat go.mod
Step 2: Copy Template Files
Copy templates from assets/ directory:
cp assets/.goreleaser.yml .
cp assets/Dockerfile .
mkdir -p resources/etc
cp assets/resources/etc/passwd resources/etc/
Step 3: Customize Configuration
Update .goreleaser.yml with project-specific values:
- Project name: Replace
PROJECT_NAME with actual name
- Build configuration:
- Set
dir if main.go is not in cmd/
- Adjust
ldflags for version injection
- Configure target OS/architectures
- Docker registry: Update image templates
- GitHub:
ghcr.io/OWNER/PROJECT
- GitLab:
registry.gitlab.com/OWNER/PROJECT
- Docker Hub:
docker.io/OWNER/PROJECT
- Homebrew tap (optional): Configure repository and token
Step 4: Update Dockerfile
Customize the Dockerfile:
- Replace
PROJECT_BINARY with actual binary name
- Adjust user name in both Dockerfile and
resources/etc/passwd
- Add any additional runtime dependencies
Step 5: Set Up CI/CD Integration
Add environment variables to CI/CD:
GITHUB_TOKEN
HOMEBREW_TAP_TOKEN
GITLAB_TOKEN
HOMEBREW_TAP_TOKEN
Step 6: Test Configuration
Validate before tagging:
goreleaser check
goreleaser build --snapshot --clean
goreleaser release --snapshot --clean --skip=publish
Step 7: Create Release
When ready:
git tag -a v1.0.0 -m "Release v1.0.0"
git push origin v1.0.0
goreleaser release --clean
Template Files & Patterns
Templates in assets/ directory:
.goreleaser.yml - Complete config with multi-arch Docker, Homebrew, archives
Dockerfile - Optimized multi-stage Docker build
resources/etc/passwd - Non-root container user config
For simpler patterns (binary-only, Docker-only, private registries), see REFERENCE.md.
Task Runner Integration
Integrate with Taskfile.yml:
version: '3'
tasks:
release:check:
desc: Validate GoReleaser config
cmds:
- goreleaser check
release:snapshot:
desc: Test release build
cmds:
- goreleaser release --snapshot --clean --skip=publish
release:
desc: Create production release
cmds:
- goreleaser release --clean
Expected Output
After using this skill, the project will have:
- ✓
.goreleaser.yml configured for the project
- ✓
Dockerfile for multi-architecture builds
- ✓
resources/etc/passwd for non-root container user
- ✓ CI/CD pipeline ready for automated releases
- ✓ Tested snapshot builds
Users can then create releases by simply pushing Git tags.
Additional Documentation
- Configuration patterns and examples: See REFERENCE.md
- Troubleshooting common issues: See TROUBLESHOOTING.md
- Template files: Available in
assets/ directory
Best Practices
- Semantic Versioning: Use
v1.2.3 format for tags
- Conventional Commits: Enables automatic changelog generation
- Test Snapshots: Always test with
--snapshot before tagging
- Multi-arch Testing: Verify builds work on target architectures
- Secret Management: Never commit tokens, use CI/CD secrets
Resources