generated from eblume/project-template
fix: --version reports release version + build SHA (tag-only version bump) #5
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feature/release-version-bump"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Fixes
heph/hephd--versionreporting0.0.0for released installs. Because releases are git-tag-driven andCargo.tomldeliberately stays0.0.0, the only thing--version(viaCARGO_PKG_VERSION) can read is the manifest at the tagged commit — and a build-timegit describecan't help (cargo's--git --tagcheckout doesn't carry the tag ref; verified it returns the bare SHA).So the version is baked into the manifest on the release tag only, and a build-time SHA is added for traceability.
--versionoutputcargo install --git --tag v1.0.0):heph 1.0.0 (ab6701d12)heph 0.0.0 (<sha>)(-dirtysuffix for an unclean tree)How it works
heph-coregains abuild.rsthat captures the short git SHA (env override →git rev-parse→unknown) and aheph_core::VERSIONconst ="<crate-version> (<sha>)".heph/hephduse it for clap'sversion.release.yaml:mainfirst (so the tag includes its own changelog).Cargo.toml+Cargo.lockto the release version on a commit that only the tag points at, tags it manually, and pushes just the tag.mainstays0.0.0.mainkeeps the always-0.0.0convention; only the tag carries the real version.Testing
cargo build -p heph -p hephd→--versionshows0.0.0 (<sha>-dirty)locallysedto realCargo.toml+Cargo.lock,cargo build --lockedsucceeds,--versionshows9.9.9 (<sha>), revertedseddry-run hits exactly 1 line inCargo.toml+ the 5 workspace crates inCargo.lock(no third-party0.0.0)release.yamlYAML validates; step order correctNotes / follow-ups
heph+hephd(they expose--version);heph-tui/heph-quickaddcan adoptheph_core::VERSIONtrivially later.install-heph.mdstill says "until v1 is tagged, install from the branch" — stale now that v1.0.0 exists, but left out of scope here.🤖 Generated with Claude Code
heph-core gains a build.rs that captures the short git SHA and a `heph_core::VERSION` const ("<crate-version> (<sha>)"); heph and hephd use it for clap's --version. The crate version stays sourced from Cargo.toml. release.yaml now bumps the workspace version into Cargo.toml + Cargo.lock on a commit that only the tag points at, tags it manually, and pushes just the tag — so cargo install --git --tag vX.Y.Z reports the real version while main stays at 0.0.0. The changelog commit moved ahead of the tag so the release includes its own changelog. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>