Skip to content

Derive CLI version from build info + binary release workflow#52

Merged
wolveix merged 1 commit into
mainfrom
feat/version-from-build-info
Jul 16, 2026
Merged

Derive CLI version from build info + binary release workflow#52
wolveix merged 1 commit into
mainfrom
feat/version-from-build-info

Conversation

@wolveix

@wolveix wolveix commented Jul 16, 2026

Copy link
Copy Markdown
Member

Fixes #51.

Problem

The version was a hardcoded "OpenRDAP v0.9.1" string that had to be bumped by hand each release. It was missed for v0.10.0, so rdap -V reported the wrong version.

Change

versionString() resolves the version in order:

  1. releaseVersion injected via -ldflags "-X github.com/openrdap/rdap.releaseVersion=<tag>" (set for released binaries)
  2. module version from debug.ReadBuildInfo() so go install github.com/openrdap/rdap/cmd/rdap@vX.Y.Z self-reports
  3. (dev) fallback

New release.yml cross-compiles binaries with gox on each release and injects the tag. Added linux/arm64 (the list previously only had 32-bit linux/arm). The CLI golden test normalizes the runtime version to stay deterministic.

Verification

Scenario Output
go install ...@v0.99.0 (real, via local module proxy) OpenRDAP v0.99.0
Released zip (ldflags) OpenRDAP v0.11.0
Plain go build OpenRDAP v0.10.0+dirty
go build -buildvcs=false OpenRDAP (dev)

go test ./... passes.

Summary by CodeRabbit

  • New Features
    • Added an automated GitHub Actions workflow to build cross-platform release binaries and upload zipped artifacts to each GitHub Release.
  • Changes
    • Updated the CLI version banner/help text to reflect the actual released version (with development fallback).
  • Tests
    • Adjusted CLI golden tests to remain deterministic with dynamic version output.
  • Chores
    • Updated the golang.org/x/crypto dependency.

@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@wolveix, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 53 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 230598c2-6b26-4d9f-a47a-d0a443649d71

📥 Commits

Reviewing files that changed from the base of the PR and between 01d68eb and b4ba298.

⛔ Files ignored due to path filters (1)
  • go.sum is excluded by !**/*.sum
📒 Files selected for processing (6)
  • .github/workflows/release.yml
  • cli.go
  • cli_test.go
  • go.mod
  • testdata/cli/no-args.golden
  • testdata/cli/version.golden
📝 Walkthrough

Walkthrough

Adds runtime-derived CLI version output with release linker injection, Go build metadata fallback, and deterministic golden tests. Adds a release-triggered GitHub Actions workflow that cross-compiles Go binaries, archives them, and uploads ZIP files to the GitHub Release. Updates golang.org/x/crypto to v0.54.0.

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning go.mod bumps golang.org/x/crypto, which is unrelated to the versioning and release workflow goals. Remove the dependency bump unless needed for the feature, or split it into a separate PR with its own reason.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed Title matches the main change: dynamic CLI versioning plus release binary workflow.
Linked Issues check ✅ Passed Issue #51 is met: rdap -V now uses build info or injected releaseVersion, not hardcoded v0.9.1.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/version-from-build-info

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.

@wolveix
wolveix force-pushed the feat/version-from-build-info branch 2 times, most recently from a1c9419 to 01d68eb Compare July 16, 2026 21:35

@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

🧹 Nitpick comments (1)
.github/workflows/release.yml (1)

28-38: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚖️ Poor tradeoff

Replace dead tool gox with native build matrix.

Tool gox dead. No updates since 2018. Go 1.26 might break. Use native GitHub Actions matrix with go build. Less tools. Native support.


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 727e6bc4-daa2-4cd4-8e20-d094a1276c9b

📥 Commits

Reviewing files that changed from the base of the PR and between a095c49 and 58c444b.

📒 Files selected for processing (5)
  • .github/workflows/release.yml
  • cli.go
  • cli_test.go
  • testdata/cli/no-args.golden
  • testdata/cli/version.golden

Comment thread .github/workflows/release.yml
Comment thread .github/workflows/release.yml
Replace the hardcoded "OpenRDAP v0.9.1" string, which had to be manually
bumped each release and was missed for v0.10.0 (#51).

Version now resolves in order: ldflags-injected releaseVersion (set for
released binaries), then the module version from debug.ReadBuildInfo()
(so `go install ...@vX.Y.Z` self-reports), then "(dev)".

Add a release workflow that cross-compiles binaries with gox on each
release, injecting the tag via -ldflags. Added linux/arm64 to the target
list. The CLI golden test normalizes the runtime version so it stays
deterministic.
@wolveix
wolveix force-pushed the feat/version-from-build-info branch from 01d68eb to b4ba298 Compare July 16, 2026 21:38

@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.

🧹 Nitpick comments (1)
.github/workflows/release.yml (1)

39-44: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Use built-in GitHub CLI.

Runner have gh CLI. Drop third-party action. Use gh release upload.

♻️ Proposed refactor
       - name: Upload Release Assets
-        uses: softprops/action-gh-release@v2
-        with:
-          files: builds/compressed/*.zip
         env:
           GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+          TAG: ${{ github.event.release.tag_name }}
+        run: gh release upload "${TAG}" builds/compressed/*.zip

Source: Linters/SAST tools


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 9a4b872a-2ee2-47f4-b2a9-b916f8d4b3c7

📥 Commits

Reviewing files that changed from the base of the PR and between 58c444b and 01d68eb.

⛔ Files ignored due to path filters (1)
  • go.sum is excluded by !**/*.sum
📒 Files selected for processing (6)
  • .github/workflows/release.yml
  • cli.go
  • cli_test.go
  • go.mod
  • testdata/cli/no-args.golden
  • testdata/cli/version.golden
🚧 Files skipped from review as they are similar to previous changes (2)
  • testdata/cli/no-args.golden
  • cli.go

@wolveix wolveix mentioned this pull request Jul 16, 2026
@wolveix
wolveix merged commit c9246cb into main Jul 16, 2026
4 of 5 checks passed
@wolveix
wolveix deleted the feat/version-from-build-info branch July 16, 2026 21:42
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.

rdap -V outputs outdated version v0.9.1 in v0.10.0 release

1 participant