ref:main

feat(ci): bake CalVer version into released binaries #4

merged colechristensen cole.christensen@gmail.com wants to merge fix/git-safe-directory into main
No CI

Summary

  • Add build.rs that runs git describe --tags --always and sets ANVIL_VERSION at compile time
  • Clap reads ANVIL_VERSION for --version output instead of CARGO_PKG_VERSION
  • CI bootstrap-builds once (to get the anvil binary for release.sh), computes the CalVer version, creates a local git tag, then rebuilds so the version is baked into the released binary
  • Dev builds report git SHA (anvil 9ff9d8e), release builds report CalVer (anvil 2026.04.2)

How it works

The local tag only exists inside the CI container — it never gets pushed. The server-side tag is created by anvil release create --tag $VERSION. No commits to main, no branch protection issues, no CI loops.

Refs #1

Test plan

  • Local build without tags → reports git SHA
  • Local build with tag → reports tag
  • fmt, clippy, tests pass
  • CI publishes release with version-stamped binary
Created Apr 12, 2026 at 16:58 UTC | Merged Apr 12, 2026 at 17:27 UTC by colechristensen cole.christensen@gmail.com