feat: add binary release workflows and simplify README downloads section.#378
Conversation
Signed-off-by: M Sajid Mansoori <mmansoor@redhat.com>
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughAdds a GitHub Actions workflow that builds crane for five OS/arch targets with CGO disabled, uploads per-target artifacts and per-binary .sha256 files, and on tag refs aggregates checksums and publishes a draft release. README gains a Download section and updated install instructions. ChangesMulti-Platform Binary Build and Release Workflow
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related issues
Possibly related PRs
Suggested reviewers
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 |
Test Coverage ReportTotal: 39.8% Per-package coverage
Full function-level detailsPosted by CI |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (2)
.github/workflows/build-crane-binaries.yml (2)
10-11: 💤 Low valueReconsider the daily cron schedule.
The daily scheduled build at 2 AM runs regardless of whether code has changed, potentially wasting CI minutes and resources. Consider removing this trigger unless there's a specific need to test against daily dependency updates or external changes.
♻️ Proposed fix to remove daily schedule
- schedule: - - cron: "0 2 * * *"🤖 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 @.github/workflows/build-crane-binaries.yml around lines 10 - 11, Remove the unconditional daily cron trigger by deleting or commenting out the schedule block (the schedule: key and the cron: "0 2 * * *" line) so the workflow only runs on explicit triggers (e.g., push, pull_request) or add a conditional check; update the workflow to rely on existing event triggers instead of the schedule unless you need automated daily builds for dependency checks or external changes.
59-59: 💤 Low valueConsider adding version information via ldflags.
The build command doesn't inject version information into the binary. Consider adding
-ldflagsto embed version, commit hash, or build date for better observability.📦 Example with version ldflags
binary="crane_${GOOS}_${GOARCH}${ext}" - go build -trimpath -o "dist/${binary}" . + VERSION="${GITHUB_REF_NAME:-dev}" + COMMIT="${GITHUB_SHA::7}" + BUILD_DATE="$(date -u +%Y-%m-%dT%H:%M:%SZ)" + go build -trimpath \ + -ldflags "-s -w -X main.Version=${VERSION} -X main.Commit=${COMMIT} -X main.BuildDate=${BUILD_DATE}" \ + -o "dist/${binary}" .Note: This assumes your code has corresponding variables like
var Version stringin the main package.🤖 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 @.github/workflows/build-crane-binaries.yml at line 59, The build step should inject version metadata via go linker flags: modify the go build invocation that currently runs go build -trimpath -o "dist/${binary}" . to add an -ldflags argument that sets package-level variables (e.g. main.Version, main.Commit, main.BuildDate) using GitHub Actions expressions (like github.ref, github.sha, and a timestamp or run number). Ensure your main package defines the corresponding variables (e.g. var Version, Commit, BuildDate string) so the -X assignments (for example -X 'main.Version=...' -X 'main.Commit=...' -X 'main.BuildDate=...') embed the values into the binary at build time.
🤖 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 @.github/workflows/build-crane-binaries.yml:
- Around line 89-97: The workflow step "Create combined checksums manifest" uses
Bash-specific [[ ]] in the for-loop test; change the step to explicitly run the
script with bash or replace the conditional with POSIX-compliant syntax. Locate
the step named "Create combined checksums manifest" and either add an explicit
bash shebang at the top of the run block so the for loop and [[ ]] are executed
by bash, or replace the `[[ "$binary" != *.sha256 ]]` test with a POSIX-safe
alternative (e.g., using case or single-bracket tests and pattern matching)
while keeping the existing `sha256sum` append to checksums.txt unchanged.
- Around line 99-106: The release step using softprops/action-gh-release
currently uploads release-assets/crane_* which also matches individual .sha256
files; modify the "Create draft GitHub release" step (uses:
softprops/action-gh-release@v2) to exclude individual checksum files by changing
the files input to either use a negation pattern to omit *.sha256 (e.g., exclude
release-assets/*.sha256) or explicitly list only the binary patterns (e.g.,
release-assets/crane_*_linux_amd64, release-assets/crane_*_darwin_arm64, etc.),
or alternatively add a prior step to remove or move *.sha256 files before this
action so only the combined release-assets/checksums.txt and binaries are
uploaded.
---
Nitpick comments:
In @.github/workflows/build-crane-binaries.yml:
- Around line 10-11: Remove the unconditional daily cron trigger by deleting or
commenting out the schedule block (the schedule: key and the cron: "0 2 * * *"
line) so the workflow only runs on explicit triggers (e.g., push, pull_request)
or add a conditional check; update the workflow to rely on existing event
triggers instead of the schedule unless you need automated daily builds for
dependency checks or external changes.
- Line 59: The build step should inject version metadata via go linker flags:
modify the go build invocation that currently runs go build -trimpath -o
"dist/${binary}" . to add an -ldflags argument that sets package-level variables
(e.g. main.Version, main.Commit, main.BuildDate) using GitHub Actions
expressions (like github.ref, github.sha, and a timestamp or run number). Ensure
your main package defines the corresponding variables (e.g. var Version, Commit,
BuildDate string) so the -X assignments (for example -X 'main.Version=...' -X
'main.Commit=...' -X 'main.BuildDate=...') embed the values into the binary at
build time.
🪄 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: defaults
Review profile: CHILL
Plan: Pro
Run ID: 45b22f43-1b9e-406c-aa8b-691a9353a108
📒 Files selected for processing (1)
.github/workflows/build-crane-binaries.yml
Signed-off-by: M Sajid Mansoori <mmansoor@redhat.com>
478c315 to
5e38a62
Compare
…zip files already Signed-off-by: M Sajid Mansoori <mmansoor@redhat.com>
2e01943 to
4d3dccf
Compare
Signed-off-by: M Sajid Mansoori <mmansoor@redhat.com>
4d3dccf to
21296cd
Compare
Signed-off-by: M Sajid Mansoori <mmansoor@redhat.com>
fd06bb2 to
3acbab3
Compare
Signed-off-by: M Sajid Mansoori <mmansoor@redhat.com>
be07268 to
cf29627
Compare
aufi
left a comment
There was a problem hiding this comment.
Gave a brief look, looks good, let's see it working. LGTM.
Summary by CodeRabbit
Creating a Draft Release with
build-release-binaries.ymlThis workflow automatically creates a draft GitHub release when triggered by a tag push.
Trigger behavior
pushtomain-> builds binaries and uploads workflow artifacts (no GitHub Release)schedule-> builds binaries and uploads workflow artifacts (no GitHub Release)workflow_dispatch-> builds binaries and uploads workflow artifacts (no GitHub Release)pushtag -> builds binaries, then creates a draft release with attached assetsRelease draft process
Build Crane Binariesworkflow run for that tag to complete.release-assets/,checksums.txt,Expected draft assets
crane_*binarieschecksums.txt(combined checksum manifest)Notes
if: startsWith(github.ref, 'refs/tags/')).softprops/action-gh-releasewithdraft: true, so no release is published automatically.Sample draft release