Skip to content

project: add versioned release workflow and squirrel version#166

Open
mbertschler wants to merge 2 commits into
mainfrom
claude/issue-151-release-versioning
Open

project: add versioned release workflow and squirrel version#166
mbertschler wants to merge 2 commits into
mainfrom
claude/issue-151-release-versioning

Conversation

@mbertschler

Copy link
Copy Markdown
Owner

Summary

Gives squirrel a release/packaging story: semver tags become the source of truth for the tool version, that version is stamped into the binary at build time, and a tag push produces a GitHub Release with cross-platform binaries. Closes the gap where the only install path was go install ...@latest from source and the binary could not report what it was (0.0.0-dev placeholder).

Changes

  • Build-time version injection (cmd/squirrel/version.go): replaces the hardcoded agentVersion = "0.0.0-dev" const in agent.go with package-level version / commit / date vars, injected via -ldflags -X main.*. The same version string feeds the agent's GET /v1/health response and its startup log line. A plain go build / go install keeps the 0.0.0-dev placeholder, so a source build stays distinguishable from a tagged release.
  • squirrel version subcommand (own file, per the one-cobra-command-per-file convention): prints version, commit, build date, and the Go toolchain / target platform.
  • .goreleaser.yaml: cross-compiles the CGO-free CLI (modernc.org/sqlite is pure Go) for linux/darwin/windows × amd64/arm64, injects the ldflags, and produces tar.gz (zip on Windows) archives plus a checksums.txt. cmd/squirrel-desktop (Wails + CGO + native WebKitGTK) is deliberately out of scope.
  • .github/workflows/release.yml: tag-triggered (v*.*.*) workflow that runs GoReleaser, modeled on the existing ci.yml style.
  • README.md §Install: documents the prebuilt-binary path alongside go install.

No DB schema change — the tool's release version is separate from SchemaVersion, which is untouched.

Testing

  • go vet ./... — clean
  • go test ./... — all pass (added TestVersionCommand; existing /v1/health test still passes)
  • golangci-lint run (v2.12.2) — 0 issues
  • Verified -ldflags -X injection: a build with main.version=v1.2.3 reports squirrel v1.2.3 via squirrel version
  • Verified CGO-free cross-compilation for linux/arm64, darwin/arm64, windows/amd64
  • goreleaser check (v2.12.5) validates .goreleaser.yaml

Closes #151

🤖 Generated with Claude Code

https://claude.ai/code/session_014Skm2Qm6wWUB7dD4CpPTz7


Generated by Claude Code

Give squirrel a real release/packaging story (#151):

- Build-time version injection: replace the hardcoded `0.0.0-dev`
  agentVersion const with package-level `version`/`commit`/`date`
  vars (cmd/squirrel/version.go), stamped via `-ldflags -X main.*`.
  The same `version` string feeds the agent's GET /v1/health.
- `squirrel version` subcommand (own file) prints version, commit,
  build date, and Go toolchain / platform.
- `.goreleaser.yaml` + tag-triggered `.github/workflows/release.yml`:
  pushing a vX.Y.Z tag cross-compiles the CGO-free CLI (linux/darwin/
  windows, amd64/arm64) and publishes archives + checksums as a
  GitHub Release. squirrel-desktop (Wails/CGO) stays out of scope.
- README §Install documents the prebuilt-binary path alongside
  `go install`.

No DB schema change: the tool's release version is separate from
SchemaVersion.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014Skm2Qm6wWUB7dD4CpPTz7
Copilot AI review requested due to automatic review settings July 24, 2026 11:02

Copilot AI 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.

Pull request overview

Adds a first-class release/versioning story for squirrel: semver tags drive GitHub Releases with cross-platform CLI binaries, and the built binary now reports its stamped version (both via squirrel version and the agent’s /v1/health).

Changes:

  • Introduces build-time-injected build metadata (version/commit/date) and a new squirrel version subcommand (with tests).
  • Wires the injected version string into the agent’s startup log and /v1/health response.
  • Adds GoReleaser configuration + a tag-triggered GitHub Actions release workflow, and updates install docs to include prebuilt binaries.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
README.md Documents installing from GitHub Releases alongside go install, and notes version reporting.
cmd/squirrel/version.go Adds build metadata variables and implements squirrel version output formatting.
cmd/squirrel/version_test.go Adds coverage for the version command output.
cmd/squirrel/root.go Registers the new version subcommand.
cmd/squirrel/agent.go Replaces the old hardcoded agent version with the injected build version.
.goreleaser.yaml Defines cross-platform CLI builds/archives/checksums and ldflags injection.
.github/workflows/release.yml Adds tag-triggered workflow to run GoReleaser and publish a GitHub Release.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .goreleaser.yaml Outdated
Comment thread README.md
- .goreleaser.yaml: use `go mod download` instead of `go mod tidy` in
  before.hooks so a tagged release never rewrites go.mod/go.sum and
  fails on a dirty tree; CI already enforces tidiness on every push.
- README: add a one-line Windows hint (download the `_windows_` .zip,
  extract squirrel.exe) so the cross-platform install is actionable.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014Skm2Qm6wWUB7dD4CpPTz7
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.

project: add a release/packaging workflow (versioned builds + install path)

3 participants