Skip to content

CI: Use goreleaser to build release artifacts#124

Merged
heathcliff26 merged 1 commit into
mainfrom
goreleaser
May 12, 2026
Merged

CI: Use goreleaser to build release artifacts#124
heathcliff26 merged 1 commit into
mainfrom
goreleaser

Conversation

@heathcliff26

Copy link
Copy Markdown
Owner

Instead of a matrix build job, use goreleaser instead.

Signed-off-by: Heathcliff heathcliff@heathcliff.eu

@coderabbitai

coderabbitai Bot commented May 12, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

This PR centralizes builds with GoReleaser by adding .goreleaser.yaml, a release script (hack/release.sh) that downloads/runs goreleaser and normalizes artifacts into top-level dist/, and a cleanup script (hack/clean.sh). The Makefile gains a release target and delegates clean to hack/clean.sh; .gitignore now ignores /dist. CI workflows are simplified to call make release instead of per-arch build steps, and the release workflow's artifact selector is adjusted to the consolidated artifact name.

Poem

🐰 I hopped through builds with nimble paws,
Found goreleaser’s tidy laws,
Scripts and Makefile in a neat parade,
Dist tucked safe in the ignore brigade,
Now releases waltz — no arch cascade!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title 'CI: Use goreleaser to build release artifacts' accurately summarizes the main change—replacing the matrix build job with goreleaser for building release artifacts.
Description check ✅ Passed The description 'Instead of a matrix build job, use goreleaser instead' directly relates to the changeset and explains the core objective of replacing the matrix build approach with goreleaser.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch goreleaser

Comment @coderabbitai help to get the list of available commands and usage tips.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a release automation workflow by adding a GoReleaser configuration and helper scripts for building and cleaning artifacts. The feedback focuses on improving the robustness and portability of the shell scripts, specifically addressing a dangerous directory deletion risk, replacing the non-portable realpath command, handling potential null values in JSON processing, and optimizing data piping for efficiency.

Comment thread hack/release.sh
Comment thread hack/clean.sh
Comment thread hack/release.sh
Comment thread hack/release.sh
Comment thread hack/release.sh
Comment thread hack/release.sh

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've left some high level feedback:

  • The hack/release.sh script downloads the latest goreleaser from the internet, which can make CI runs non-deterministic; consider pinning a specific version (or reading it from an env/var) so builds are reproducible.
  • hack/release.sh assumes yq, jq, curl, and tar are present; adding explicit checks with clear error messages for these tools would make failures easier to diagnose when running the script locally or in new environments.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The `hack/release.sh` script downloads the latest goreleaser from the internet, which can make CI runs non-deterministic; consider pinning a specific version (or reading it from an env/var) so builds are reproducible.
- `hack/release.sh` assumes `yq`, `jq`, `curl`, and `tar` are present; adding explicit checks with clear error messages for these tools would make failures easier to diagnose when running the script locally or in new environments.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@coveralls

coveralls commented May 12, 2026

Copy link
Copy Markdown

Coverage Report for CI Build 25744734712

Coverage remained the same at 91.698%

Details

  • Coverage remained the same as the base build.
  • Patch coverage: No coverable lines changed in this PR.
  • No coverage regressions found.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 1048
Covered Lines: 961
Line Coverage: 91.7%
Coverage Strength: 52.75 hits per line

💛 - Coveralls

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@hack/release.sh`:
- Around line 47-48: Replace the recursive delete call that can fail when files
are absent: in the cleanup step that currently calls rm -r on "artifacts.json",
"config.yaml", and "metadata.json", use rm -f (without -r) so missing files are
ignored and the script won’t exit under set -e; update the command that
references dist_dir and those three filenames accordingly.
- Around line 15-23: The script currently uses LATEST="$(curl -sf
https://goreleaser.com/static/latest)" and downloads/verifies nothing; change it
to pin a specific GoReleaser version (or read from an env var like
GORELEASER_VERSION) and download both the matching tarball and its SHA256
checksum file, verify the checksum against the downloaded
"${bin_dir}/goreleaser.tar.gz" before extracting, and fail the script on
mismatch; update uses of LATEST, the curl target URL, and the
goreleaser="${bin_dir}/goreleaser" assignment accordingly so the verification
happens prior to tar -xzf and removal of the archive.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 9f834ce8-d0e9-4732-8dd3-92ad11570042

📥 Commits

Reviewing files that changed from the base of the PR and between 3e91339 and 7ac7361.

📒 Files selected for processing (7)
  • .github/workflows/ci.yaml
  • .github/workflows/release.yaml
  • .gitignore
  • .goreleaser.yaml
  • Makefile
  • hack/clean.sh
  • hack/release.sh

Comment thread hack/release.sh
Comment thread hack/release.sh
Instead of a matrix build job, use goreleaser instead.

Signed-off-by: Heathcliff <heathcliff@heathcliff.eu>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

♻️ Duplicate comments (2)
hack/release.sh (2)

48-48: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Use rm -f for metadata cleanup files.

With set -e, this can fail if any file is absent; these files are not guaranteed in every interrupted/partial run.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@hack/release.sh` at line 48, Replace the fragile recursive remove command
that can fail under set -e with a forceful non-recursive delete: change the rm
-r invocation that references the artifacts.json, config.yaml and metadata.json
variables to rm -f "${dist_dir}/artifacts.json" "${dist_dir}/config.yaml"
"${dist_dir}/metadata.json" so missing files don't cause the script to exit;
keep the same variable names (dist_dir) and target filenames when making the
change.

15-23: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Pin and verify downloaded GoReleaser binary before extraction.

The script still pulls latest and extracts without integrity verification, which is non-reproducible and weakens supply-chain safety.

#!/bin/bash
# Verify current behavior is still "latest" + no checksum validation
sed -n '15,23p' hack/release.sh | cat -n
rg -n 'static/latest|checksums|sha256' hack/release.sh
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@hack/release.sh` around lines 15 - 23, The script currently downloads the
"latest" GoReleaser tarball (variable LATEST) and extracts it without
verification; change it to pin and verify the binary before extraction by
resolving a specific release tag (do not rely on static/latest), downloading the
corresponding checksum or signature for that release, validating the tarball's
SHA256 (or signature) against the downloaded checksum, and aborting on mismatch;
update the download/extract sequence that uses arch, curl, tar and
goreleaser="${bin_dir}/goreleaser" to perform checksum verification (fail early
if validation fails) before calling tar -xzf.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@hack/release.sh`:
- Line 8: This script uses external tools (yq, jq, curl, tar) but doesn't verify
they exist up front; add a fail-fast check near the script start that iterates
over the required commands (yq, jq, curl, tar) using command -v (or which) and
prints a clear error like "required tool X not found, please install" then exits
non-zero if any are missing; place this check before variables like name="$(yq
-r '.project_name' "${base_dir}/.goreleaser.yaml")" so missing dependencies are
detected early.

---

Duplicate comments:
In `@hack/release.sh`:
- Line 48: Replace the fragile recursive remove command that can fail under set
-e with a forceful non-recursive delete: change the rm -r invocation that
references the artifacts.json, config.yaml and metadata.json variables to rm -f
"${dist_dir}/artifacts.json" "${dist_dir}/config.yaml"
"${dist_dir}/metadata.json" so missing files don't cause the script to exit;
keep the same variable names (dist_dir) and target filenames when making the
change.
- Around line 15-23: The script currently downloads the "latest" GoReleaser
tarball (variable LATEST) and extracts it without verification; change it to pin
and verify the binary before extraction by resolving a specific release tag (do
not rely on static/latest), downloading the corresponding checksum or signature
for that release, validating the tarball's SHA256 (or signature) against the
downloaded checksum, and aborting on mismatch; update the download/extract
sequence that uses arch, curl, tar and goreleaser="${bin_dir}/goreleaser" to
perform checksum verification (fail early if validation fails) before calling
tar -xzf.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: a0ea6f2f-d493-4e69-ae9b-3a5d10b56f28

📥 Commits

Reviewing files that changed from the base of the PR and between 7ac7361 and 767602c.

📒 Files selected for processing (7)
  • .github/workflows/ci.yaml
  • .github/workflows/release.yaml
  • .gitignore
  • .goreleaser.yaml
  • Makefile
  • hack/clean.sh
  • hack/release.sh

Comment thread hack/release.sh
@heathcliff26 heathcliff26 enabled auto-merge (rebase) May 12, 2026 15:37
@heathcliff26 heathcliff26 disabled auto-merge May 12, 2026 15:37
@heathcliff26 heathcliff26 merged commit 784e42b into main May 12, 2026
20 checks passed
@heathcliff26 heathcliff26 deleted the goreleaser branch May 12, 2026 15:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants