Skip to content

ci(release): add goreleaser config and GitHub Actions workflow#113

Merged
feloy merged 2 commits intokortex-hub:mainfrom
MarsKubeX:build-binaries-goreleaser
Mar 27, 2026
Merged

ci(release): add goreleaser config and GitHub Actions workflow#113
feloy merged 2 commits intokortex-hub:mainfrom
MarsKubeX:build-binaries-goreleaser

Conversation

@MarsKubeX
Copy link
Copy Markdown
Contributor

Enable automated cross-platform binary releases triggered by version tags, so consumers can download pre-built
binaries instead of building from source.

  • Add .goreleaser.yaml to cross-compile kortex-cli for 6 targets: linux/darwin/windows x amd64/arm64
  • Add .github/workflows/release.yml triggered on v* tags to automate GitHub Releases with goreleaser
  • Version is injected at build time via ldflags into pkg/version.Version
  • Archives are .tar.gz for linux/macOS and .zip for Windows, with SHA-256 checksums

Closes #21

@MarsKubeX MarsKubeX self-assigned this Mar 26, 2026
@codecov-commenter
Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 26, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 2768986a-010d-4e1c-a8fc-5cc688621af5

📥 Commits

Reviewing files that changed from the base of the PR and between f5ddef2 and cc5ee70.

📒 Files selected for processing (2)
  • .github/workflows/release.yml
  • .goreleaser.yaml
✅ Files skipped from review due to trivial changes (2)
  • .goreleaser.yaml
  • .github/workflows/release.yml

📝 Walkthrough

Walkthrough

Adds automated release infrastructure: a tag-triggered GitHub Actions workflow (.github/workflows/release.yml) and a GoReleaser configuration (.goreleaser.yaml) to build, archive, and publish kortex-cli binaries for multiple OS/architectures.

Changes

Cohort / File(s) Summary
Release workflow
./.github/workflows/release.yml
New GitHub Actions workflow triggered on tag pushes matching v*; checks out full repo history, sets repository permissions, installs Go using go.mod, and runs GoReleaser action (goreleaser/goreleaser-action ~> v2.14) with release --clean using secrets.GITHUB_TOKEN.
GoReleaser config
./.goreleaser.yaml
New GoReleaser configuration: runs go mod tidy, builds kortex-cli from ./cmd/kortex-cli for linux/darwin/windows on amd64/arm64 with CGO_ENABLED=0, injects version via ldflags, strips symbols, archives as tar.gz (overrides to zip for Windows), sorts/filters changelog, and publishes GitHub releases under kortex-hub/kortex-cli.

Sequence Diagram(s)

sequenceDiagram
  participant Dev as Developer
  participant GH as GitHub (repo)
  participant Runner as Actions Runner
  participant GRA as GoReleaser Action
  participant GHRel as GitHub Releases

  Dev->>GH: push tag (v*)
  GH->>Runner: trigger `release` workflow
  Runner->>Runner: checkout (fetch-depth:0), setup Go
  Runner->>GRA: run goreleaser action (release --clean)
  GRA->>GHRel: create artifacts and publish release (uses GITHUB_TOKEN)
  GHRel-->>Dev: release published
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main changes: adding goreleaser configuration and GitHub Actions workflow for automated releases.
Description check ✅ Passed The description is directly related to the changeset, explaining the purpose of adding goreleaser config and GitHub Actions workflow for cross-platform binary releases.
Linked Issues check ✅ Passed The PR fully implements the requirements from issue #21: adopts goreleaser to build binaries for multiple platforms (linux/darwin/windows x amd64/arm64) and provides pre-built cross-platform binaries.
Out of Scope Changes check ✅ Passed All changes are directly scoped to implementing goreleaser configuration and GitHub Actions workflow for automated releases; no out-of-scope modifications detected.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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


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.

❤️ Share

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

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.github/workflows/release.yml:
- Around line 46-47: Replace the non-deterministic "version: latest" entry in
the release workflow with a pinned GoReleaser Action version to ensure
reproducible releases; update the workflow step that currently sets "version"
alongside "args: release --clean" to a specific tag (e.g., a concrete vX.Y.Z) or
a stable range like "~> v2" per the goreleaser/goreleaser-action docs so the
action no longer floats to the latest release.
🪄 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: CHILL

Plan: Pro

Run ID: ce2810a0-bcdd-46fb-bf59-0faeb1d471ad

📥 Commits

Reviewing files that changed from the base of the PR and between 262dd0d and 09724d7.

📒 Files selected for processing (2)
  • .github/workflows/release.yml
  • .goreleaser.yaml

.goreleaser.yaml Outdated
Comment on lines +43 to +45
checksum:
name_template: checksums.txt
algorithm: sha256
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

question: do we need checksums ?

to me it was like old school way of providing checksums but for example on GitHub since last year checksum are provided by default by GitHub release

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I removed it. You're right, GitHub natively provides SHA-256 digests for release assets.

@feloy
Copy link
Copy Markdown
Contributor

feloy commented Mar 26, 2026

In other project I have these lines in .goreleaser.yaml:

before:
  hooks:
    # You may remove this if you don't use go modules.
    - go mod tidy

This project is using modules, I suppose they are useful (this will check that the modules dependencies are up to date)

Comment on lines +35 to +36
with:
fetch-depth: 0
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

question: why do we need a depth of 0 ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Is needed since goreleaser needs the full git history to work properly. https://goreleaser.com/customization/ci/actions/

@MarsKubeX MarsKubeX requested a review from benoitf March 26, 2026 10:16
Copy link
Copy Markdown
Contributor

@benoitf benoitf left a comment

Choose a reason for hiding this comment

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

not for this PR

but is that goreleaser is offering a way to build release after each commits ?

we often publish our builds after each commit so it's easy to try

MarsKubeX and others added 2 commits March 27, 2026 07:12
Enable automated cross-platform binary releases triggered by version
tags, so consumers can download pre-built
binaries instead of building from source.

Closes kortex-hub#21

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Marcel Bertagnini <mbertagn@redhat.com>
Address PR review feedback: pin goreleaser to ~> v2.14 for reproducible
builds, add go mod tidy before hook, and drop checksums.txt since GitHub
natively provides SHA-256 digests for release assets.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Marcel Bertagnini <mbertagn@redhat.com>
@feloy feloy force-pushed the build-binaries-goreleaser branch from f5ddef2 to cc5ee70 Compare March 27, 2026 06:12
@feloy feloy merged commit da77bab into kortex-hub:main Mar 27, 2026
6 checks passed
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.

build binaries with goreleaser

5 participants