go-release
Go Release Setup Skill
Sets up release infrastructure for Go CLI apps: GoReleaser config, Dockerfile, and GitHub Actions workflows.
Step 1 — Gather Project Info
Read go.mod to infer:
- Module path (e.g.
github.com/owner/repo) - Go version
- Binary name — check
cmd/subdirectories; if multiple, ask which one(s) to release; if absent, use the last segment of the module path
Derive <github-owner> and <github-repo> from the module path.
If any of the following cannot be inferred, ask the user:
- CGO required? — scan source files for
import "C"; if found, CGO = true, else CGO = false - App description — one-line description for the Homebrew formula and release header
- License — check
LICENSEfile; if absent, ask (default: MIT) - Distribution channels to enable (ask the user; suggest all as default):
github— GitHub Releases binary archives + checksums (always required)docker— Dockerfile + GHCR image push viadocker.ymlworkflowhomebrew— Homebrew formula pushed to<github-owner>/homebrew-taprepo
- Homebrew tap repo (homebrew only) — default
<github-owner>/homebrew-tap
Step 2 — Check What Already Exists
Before generating each file, check if it exists. Skip or ask to confirm overwrite:
Dockerfile.goreleaser.yaml.github/workflows/release.yml.github/workflows/docker.yml
Step 3 — Generate .goreleaser.yaml
Use assets/goreleaser.yaml as the template. Substitute all <placeholder> values. Then:
- Set
CGO_ENABLED=1and removewindowsfromgoosif CGO is required - Remove the
brewssection ifhomebrewis not enabled - Remove the Docker
**Docker:**block fromrelease.headerifdockeris not enabled - Remove the Homebrew
**Homebrew:**block fromrelease.headerifhomebrewis not enabled - Remove
TAP_GITHUB_TOKENfrom the env block inrelease.ymlifhomebrewis not enabled
Step 4 — Generate Dockerfile (only if docker channel enabled)
- No CGO: use
assets/Dockerfile.alpineas template - CGO required: use
assets/Dockerfile.debianas template
Substitute <go-version>, <module-path>, and <binary-name>. Adjust main path if the project doesn't use cmd/<binary-name> layout.
Step 5 — Generate GitHub Workflows
Create .github/workflows/ if it doesn't exist.
| Workflow | Source template | When to generate |
|---|---|---|
release.yml |
assets/workflows/release.yml |
Always (github channel) |
docker.yml |
assets/workflows/docker.yml |
Only if docker channel enabled |
Substitute <go-version> in each workflow. For release.yml, remove the TAP_GITHUB_TOKEN env line if homebrew is not enabled.
Note: CI workflows (tests, lint) are handled by the
go-ciskill. Only add them here if the user hasn't already set upgo-ci.
Step 6 — Optional: Create internal/version Package
If no version package exists and the project's ldflags reference internal/version, create internal/version/version.go:
package version
var (
Version = "dev"
GitCommit = "unknown"
BuildDate = "unknown"
)
Step 7 — Post-Setup Instructions
Tell the user:
-
GitHub Secrets required:
GITHUB_TOKEN— auto-provided by GitHub ActionsTAP_GITHUB_TOKEN(homebrew only) — GitHub PAT withreposcope for the tap repo
-
Homebrew tap repo (homebrew only) — create
<github-owner>/homebrew-tapwith aFormula/directory if it doesn't exist -
First release:
git tag v0.1.0 git push origin v0.1.0 -
Test locally (snapshot, no publish):
goreleaser release --snapshot --clean