fix: --version reports release version + build SHA (tag-only version bump) #5

Merged
eblume merged 3 commits from feature/release-version-bump into main 2026-06-04 10:14:06 -07:00
Owner

Summary

Fixes heph/hephd --version reporting 0.0.0 for released installs. Because releases are git-tag-driven and Cargo.toml deliberately stays 0.0.0, the only thing --version (via CARGO_PKG_VERSION) can read is the manifest at the tagged commit — and a build-time git describe can't help (cargo's --git --tag checkout 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.

--version output

  • Tagged install (cargo install --git --tag v1.0.0): heph 1.0.0 (ab6701d12)
  • Branch/dev install: heph 0.0.0 (<sha>) (-dirty suffix for an unclean tree)

How it works

  • heph-core gains a build.rs that captures the short git SHA (env override → git rev-parseunknown) and a heph_core::VERSION const = "<crate-version> (<sha>)". heph/hephd use it for clap's version.
  • release.yaml:
    • Commits consumed changelog fragments to main first (so the tag includes its own changelog).
    • Bumps Cargo.toml + Cargo.lock to the release version on a commit that only the tag points at, tags it manually, and pushes just the tag. main stays 0.0.0.
    • Attaches the Forgejo release to that pre-existing tag.

main keeps the always-0.0.0 convention; only the tag carries the real version.

Testing

  • cargo build -p heph -p hephd--version shows 0.0.0 (<sha>-dirty) locally
  • Applied the bump sed to real Cargo.toml+Cargo.lock, cargo build --locked succeeds, --version shows 9.9.9 (<sha>), reverted
  • sed dry-run hits exactly 1 line in Cargo.toml + the 5 workspace crates in Cargo.lock (no third-party 0.0.0)
  • release.yaml YAML validates; step order correct
  • End-to-end verified on the next real release run (GitOps)

Notes / follow-ups

  • Scoped to heph + hephd (they expose --version); heph-tui/heph-quickadd can adopt heph_core::VERSION trivially later.
  • install-heph.md still 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

## Summary Fixes `heph`/`hephd` `--version` reporting `0.0.0` for released installs. Because releases are git-tag-driven and `Cargo.toml` deliberately stays `0.0.0`, the only thing `--version` (via `CARGO_PKG_VERSION`) can read is the manifest at the tagged commit — and a build-time `git describe` can't help (cargo's `--git --tag` checkout 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. ### `--version` output - Tagged install (`cargo install --git --tag v1.0.0`): `heph 1.0.0 (ab6701d12)` - Branch/dev install: `heph 0.0.0 (<sha>)` (`-dirty` suffix for an unclean tree) ### How it works - `heph-core` gains a `build.rs` that captures the short git SHA (env override → `git rev-parse` → `unknown`) and a `heph_core::VERSION` const = `"<crate-version> (<sha>)"`. `heph`/`hephd` use it for clap's `version`. - `release.yaml`: - Commits consumed changelog fragments to `main` first (so the tag includes its own changelog). - Bumps `Cargo.toml` + `Cargo.lock` to the release version on a commit that **only the tag points at**, tags it manually, and pushes just the tag. `main` stays `0.0.0`. - Attaches the Forgejo release to that pre-existing tag. `main` keeps the always-`0.0.0` convention; only the tag carries the real version. ## Testing - [x] `cargo build -p heph -p hephd` → `--version` shows `0.0.0 (<sha>-dirty)` locally - [x] Applied the bump `sed` to real `Cargo.toml`+`Cargo.lock`, `cargo build --locked` succeeds, `--version` shows `9.9.9 (<sha>)`, reverted - [x] `sed` dry-run hits exactly 1 line in `Cargo.toml` + the 5 workspace crates in `Cargo.lock` (no third-party `0.0.0`) - [x] `release.yaml` YAML validates; step order correct - [ ] End-to-end verified on the next real release run (GitOps) ## Notes / follow-ups - Scoped to `heph` + `hephd` (they expose `--version`); `heph-tui`/`heph-quickadd` can adopt `heph_core::VERSION` trivially later. - `install-heph.md` still 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](https://claude.com/claude-code)
Documents the desired end state before the code change (C1 docs-first):
- release.yaml bumps the workspace version into a commit only the tag points
  at, keeping main at 0.0.0
- heph/hephd --version will report the release version plus the build SHA

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
fix: --version reports release version + build SHA; release tags a version-bump commit
Some checks failed
Build / validate (pull_request) Has been cancelled
598dc59580
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>
docs: install-heph defaults to the v1.0.0 release tag (v1 is out)
All checks were successful
Build / validate (pull_request) Successful in 5m5s
521e5d62df
Replace the pre-release 'install from feature/v1-prototype' instructions with
`--tag v1.0.0` as the default, and document `--branch main` as the track-
unreleased-work alternative.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
eblume merged commit 27855bde34 into main 2026-06-04 10:14:06 -07:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
eblume/hephaestus!5
No description provided.