# Set Up GoReleaser Releases for a Go CLI

Yes. An agent adds a GoReleaser config and a tag-triggered GitHub Actions release workflow to your Go CLI, proves it with a snapshot build, and opens a PR.

[Run this on Rush](https://cloud.getrush.ai/run/add-goreleaser/go-cli/). Opens the console with this prompt ready to send, in a Project that has your repository.

## What the agent does

The agent reads how the binary is built and shipped today. In a CLI like rakyll/hey, `go.mod` names module `github.com/rakyll/hey` on `go 1.24.0` with one direct dependency, `golang.org/x/net v0.48.0`; `hey.go` is `package main` at the repository root, and `requester/` holds the load generator with its own tests. The `Makefile` has a `release` target that runs `go build` three times with `GOOS` and `GOARCH` set, producing `bin/hey_windows_amd64`, `bin/hey_linux_amd64` and `bin/hey_darwin_amd64`, and an `upload` target that copies them to a Google Cloud Storage bucket with `gsutil`; the README's install section links to those three files on storage.googleapis.com. `hey.go` hard-codes `heyUA` as `hey/0.0.1` and the `-U` flag's help text repeats it. `.github/workflows/go.yml` runs `go build -v ./...` and `go test -v ./...` on pushes and pull requests to `master` with `setup-go` pinned to Go 1.21, older than the `go` line in `go.mod`, so that job relies on toolchain download; `.travis.yml` and the `Dockerfile`, which starts from `golang:1.15` and runs `go get`, are older still.

It writes `.goreleaser.yaml` for GoReleaser's current config version: one build with `main: .`, `binary: hey`, `CGO_ENABLED=0`, `linux`, `darwin` and `windows` for `amd64` and `arm64`, which adds Apple silicon and ARM servers to the three targets the Makefile covers, and `ldflags` that strip symbols and set a `main.version` variable from the tag. To keep the file names the README already uses, the archive format is `binary` with a name template of `hey_{{ .Os }}_{{ .Arch }}`, so each release asset is the bare executable rather than a tarball, plus a checksums file and a changelog grouped from commit messages. In `hey.go` it adds `var version = "dev"`, builds `heyUA` from it so the User-Agent carries the real version, and adds a `-version` flag that prints it; the usage text gains one line.

It adds `.github/workflows/release.yml` that runs on tags matching `v*`: `permissions` with `contents: write`, checkout with full history for the changelog, `setup-go` reading `go-version-file: go.mod`, `go test ./...`, then `goreleaser/goreleaser-action` with `release --clean` and the job's `GITHUB_TOKEN`. It points the `setup-go` step in `go.yml` at `go.mod` too, a one-line change it calls out, so both workflows build with the toolchain the module declares. The README's install section gains the GitHub Releases link above the bucket links, which stay until the maintainers cut the first release and decide to retire the bucket.

In its sandbox it runs `go test ./...`, `goreleaser check`, and `goreleaser release --snapshot --clean`, lists `dist/` to show the six binaries and the checksums file, runs the Linux binary with `-version` and against a local `python3 -m http.server` with a small `-n` and `-c` to show the load generator works, and lints the workflow with `actionlint`. No tag is pushed and no release is created; the workflow runs only when a maintainer tags.

## Start it with one API call

`POST https://api.phoenix.so/o/{org}/sessions`

```json
{
  "agent": "claude",
  "input": "Set up GoReleaser for this Go CLI and open a pull request. Read go.mod, go.sum, hey.go, hey_test.go, the requester package, the Makefile, Dockerfile, README.md and every workflow under .github/workflows first. Write .goreleaser.yaml with one build of the root main package, CGO disabled, linux, darwin and windows on amd64 and arm64, ldflags that set a main.version variable from the tag, binary archives named hey_<os>_<arch> to match the names the README links to, a checksums file and a changelog. Add a version variable and a -version flag in hey.go and build the User-Agent from it. Write .github/workflows/release.yml on tags matching v* with contents write permission, setup-go from go.mod, go test ./..., then goreleaser release --clean with the job's GITHUB_TOKEN. Point the existing CI workflow's setup-go at go.mod as well. In the sandbox run go test ./..., goreleaser check, goreleaser release --snapshot --clean, list dist, run the Linux binary with -version and against a local HTTP server, and run actionlint. Push no tag and create no release. Update the README install section and open a pull request with the dist listing and the command output.",
  "resources": [
    {
      "url": "https://github.com/your-org/your-app"
    }
  ]
}
```

1. **Get an API key.** In the console, open Settings, then API keys, and create a key for your org. Send it in the Authorization header as a Bearer token.
2. **Send the request.** POST the body in request.json to https://api.phoenix.so/o/{org}/sessions, with your repository as the resources URL. The run starts in its own cloud sandbox.
3. **Read what came back.** Follow the run on its live stream or wait for the run.completed webhook, then read the result and its trajectory.

## What comes back

What comes back is a pull request on its own branch that adds `.goreleaser.yaml` and `.github/workflows/release.yml`, edits `hey.go` for the version variable and flag, changes the `setup-go` line in `go.yml`, and updates the README install section. The description quotes `goreleaser check`, the snapshot build's `dist/` listing with the six binaries and the checksums file, the `-version` output, the short load-test output against the local server, `go test ./...` and `actionlint`.

Before merging, a reviewer checks the asset naming against what the README promises, whether to keep publishing to the bucket as well, whether `arm64` targets are wanted, and what to do with the Makefile's `release` and `upload` targets, which the pull request leaves in place. The first real release happens when a maintainer pushes a `v` tag, and its assets and changelog then appear on the Releases page.

## Run it on every Go CLI released by hand

A team with several Go tools sends one `POST /o/{org}/sessions` per repository, this prompt and the repository in `resources`. `GET /o/{org}/github` lists every repository the Rush GitHub App installation can reach, so a script can start a run for each one with a `go.mod`, a `package main` and no `.goreleaser.yaml`. Each run reads that tool's own layout, so a CLI under `cmd/<name>` or one that needs CGO gets a config that fits, and each opens its own pull request.

Set a webhook URL on the API key and Rush posts `run.completed` or `run.failed` when a run's turn finishes, with `session_url` so your server can read the pull request link. Send a fresh UUID as `request_id` with each request so a retry returns the run already started.

## Why run it on Rush?

A release pipeline is tested by releasing, which is the one thing you cannot do twice. On Rush the agent gets the next best proof in its own sandbox: a snapshot build that produces every binary the real release would, a run of the Linux binary against a local server, and a lint of the workflow, with every command and listing kept in the run's record beside the diff. The review is about naming and targets, not about whether the YAML parses.

Nothing is tagged, nothing is uploaded, and no cloud credential is needed anywhere: the release job uses the token GitHub gives the workflow. The same request sets this up for every Go tool a team maintains, one run and one pull request each.

## Frequently asked questions

### Will the asset names change for people who script the download?

No. The config uses the `binary` archive format with a `hey_<os>_<arch>` name template, so `hey_linux_amd64` stays `hey_linux_amd64`, now on the GitHub Releases page with a checksums file beside it. The `arm64` assets are additions with the same pattern.

### Does it also publish a Docker image or a Homebrew formula?

Not in this change. The repository's `Dockerfile` builds from an old Go image with `go get` and would need its own rework, and the README's `brew install` comes from Homebrew's own tap. Both can be added to the GoReleaser config in a follow-up message to the same run.

### Why change go.yml at all?

Because its `setup-go` pins Go 1.21 while `go.mod` says 1.24.0, so that job works only through toolchain download. Reading the version from `go.mod` in both workflows means the test job and the release job build with the same Go; it is one line and the pull request calls it out.

### What does the version flag show on a build from source?

`dev`, the default of the new `version` variable. GoReleaser sets it from the tag through `ldflags`, and the snapshot build in the sandbox shows the snapshot version string, so the pull request includes both outputs.

## More Go CLI jobs

- [Add govulncheck to a Go CLI's CI](https://getrush.ai/run/add-govulncheck-to-ci/go-cli/)
- [Add HTTP Timeouts to a Go CLI](https://getrush.ai/run/add-http-timeouts/go-cli/)
- [Add JSON Output to a Go Command-Line Tool](https://getrush.ai/run/add-json-output/go-cli/)

## The same job on other stacks

- [Add GoReleaser to a Cobra CLI](https://getrush.ai/run/add-goreleaser/cobra/)

## More jobs like this: Hand off a long task

- [Add govulncheck to a Cobra CLI's CI](https://getrush.ai/run/add-govulncheck-to-ci/cobra/)
- [Add govulncheck to CI for a Fiber Multi-Module Repository](https://getrush.ai/run/add-govulncheck-to-ci/fiber/)

## Keep reading

- [How a Rush run works on your repository, from request to pull request](https://getrush.ai/cloud/)
- [Compare cloud agents, agent sandboxes and AI code review](https://getrush.ai/compare/)
- [Rush pricing: Free, Pro and Max](https://getrush.ai/pricing/)
