ci(release): add goreleaser release workflow#12
Conversation
There was a problem hiding this comment.
Pull request overview
Adds GoReleaser-based automation to publish tapd cross-platform binaries to GitHub Releases on tag pushes, and provides local Makefile helpers for checking/building/publishing releases more safely.
Changes:
- Introduces a GoReleaser configuration to build archives for darwin/linux/windows (amd64/arm64) and publish checksums.
- Adds a tag-triggered GitHub Actions workflow to run tests and publish release artifacts via GoReleaser.
- Adds Makefile targets for GoReleaser config validation, snapshot builds, and a tag/confirmation-gated publish flow; ignores
dist/.
Reviewed changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| Makefile | Adds GoReleaser-driven release targets (check, snapshot, publish) with an explicit confirmation gate. |
| .goreleaser.yaml | Defines build matrix, archive naming, checksums, snapshot versioning, and changelog filtering for releases. |
| .gitignore | Ignores GoReleaser dist/ output and normalizes the .cache entry. |
| .github/workflows/release.yml | Adds a tag-based CI release pipeline using goreleaser-action to publish GitHub Release assets. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| @@ -1,5 +1,6 @@ | |||
| GO = go | |||
| GOLANGCI_LINT = $(GO) tool golangci-lint | |||
| GORELEASER = $(GO) run github.com/goreleaser/goreleaser/v2@latest | |||
| before: | ||
| hooks: | ||
| - go mod tidy -compat=1.25.0 | ||
|
|
| - name: Set up Go | ||
| uses: actions/setup-go@v6 | ||
| with: | ||
| go-version: '1.26.x' |
| - name: Run tests | ||
| run: make test | ||
|
|
||
| - name: Run GoReleaser | ||
| uses: goreleaser/goreleaser-action@v7 | ||
| with: | ||
| distribution: goreleaser | ||
| version: "~> v2" | ||
| args: release --clean |
|
Caution Review failedPull request was closed or merged during review 📝 WalkthroughWalkthroughThis PR adds a complete release automation pipeline for the ChangesRelease Pipeline Infrastructure
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Code Review
This pull request introduces release automation by integrating GoReleaser. Key changes include the addition of a ".goreleaser.yaml" configuration file, the exclusion of the "dist/" directory in ".gitignore", and new "Makefile" targets for managing release builds and safety checks. Feedback suggests optimizing the build process by using "go tool" for GoReleaser version management (leveraging Go 1.24+ features), adding "ldflags" to minimize binary size and inject versioning metadata, and adhering to Go conventions by using lowercase operating system names in archive filenames.
| @@ -1,5 +1,6 @@ | |||
| GO = go | |||
| GOLANGCI_LINT = $(GO) tool golangci-lint | |||
| GORELEASER = $(GO) run github.com/goreleaser/goreleaser/v2@latest | |||
There was a problem hiding this comment.
For consistency with the GOLANGCI_LINT definition and to leverage Go 1.24+ tool management, it is recommended to use $(GO) tool goreleaser. This ensures the tool version is pinned in go.mod and avoids downloading it on every execution. You will need to run go get -tool github.com/goreleaser/goreleaser/v2 once to update your go.mod file.
GORELEASER = $(GO) tool goreleaser
| env: | ||
| - CGO_ENABLED=0 |
There was a problem hiding this comment.
It is highly recommended to add ldflags to strip debug information (-s -w) to reduce the final binary size. Additionally, you should consider injecting versioning metadata (version, commit, date) so the CLI can report its version accurately. Note that you will need to define corresponding variables in your main package or a dedicated version package to receive these values.
env:
- CGO_ENABLED=0
ldflags:
- -s -w
- -X main.version={{.Version}}
- -X main.commit={{.Commit}}
- -X main.date={{.Date}}| name_template: >- | ||
| {{ .ProjectName }}_ | ||
| {{- .Version }}_ | ||
| {{- title .Os }}_ |
Summary
Add GoReleaser-based release automation so tag pushes can build and attach cross-platform tapd binaries to GitHub Releases.
Changes
Motivation
Testing
Summary by CodeRabbit
Release Notes