Derive the build version from the git tag #12

Merged
FernandoJVideira merged 1 commits from fix/version-from-git-tag into main 2026-10-08 23:11:42 +00:00
Owner

Summary

  • v0.2.1 was tagged on a commit whose Makefile still said VERSION := v0.2.0, so every binary attached to that release prints v0.2.0 from draft version (verified by running the published macOS asset). The version was a hand-edited constant, so tagging before committing the bump was easy to do and invisible until someone ran the binary
  • VERSION now comes from git describe --tags --always: exactly the tag on a tagged commit (v0.2.1), tag-plus-distance after it (v0.2.1-3-g1a2b3c4), and dev outside a git checkout such as a source tarball. make build VERSION=… still overrides it. There is nothing left to bump before tagging

What this does not do

It fixes the cause going forward. The binaries already attached to the v0.2.1 release still report v0.2.0 and need the release to be re-cut (or v0.2.2 published) from a build made after this merges.

Test plan

  • On the v0.2.1 commit: make version → v0.2.1
  • Commit tagged exactly: reports the tag name
  • make version VERSION=v0.2.1 → override wins
  • git archive tarball with no .git: make version → dev

🤖 Generated with Claude Code

## Summary - `v0.2.1` was tagged on a commit whose `Makefile` still said `VERSION := v0.2.0`, so every binary attached to that release prints `v0.2.0` from `draft version` (verified by running the published macOS asset). The version was a hand-edited constant, so tagging before committing the bump was easy to do and invisible until someone ran the binary - `VERSION` now comes from `git describe --tags --always`: exactly the tag on a tagged commit (`v0.2.1`), tag-plus-distance after it (`v0.2.1-3-g1a2b3c4`), and `dev` outside a git checkout such as a source tarball. `make build VERSION=…` still overrides it. There is nothing left to bump before tagging ## What this does not do It fixes the cause going forward. The binaries already attached to the `v0.2.1` release still report `v0.2.0` and need the release to be re-cut (or `v0.2.2` published) from a build made after this merges. ## Test plan - [x] On the `v0.2.1` commit: `make version` → `v0.2.1` - [x] Commit tagged exactly: reports the tag name - [x] `make version VERSION=v0.2.1` → override wins - [x] `git archive` tarball with no `.git`: `make version` → `dev` 🤖 Generated with [Claude Code](https://claude.com/claude-code)
FernandoJVideira added 1 commit 2026-10-08 23:08:57 +00:00
The version was a hand-edited constant in the Makefile, so tagging a release
without first committing the bump produced a release whose binaries disagree
with it: v0.2.1 was tagged on a commit still saying VERSION := v0.2.0, and
all four binaries attached to that release print v0.2.0 from `draft version`.

VERSION now comes from `git describe --tags --always`: exactly the tag on a
tagged commit (v0.2.1), tag-plus-distance after it (v0.2.1-3-g1a2b3c4), `dev`
outside a git checkout such as a source tarball. `make build VERSION=...`
still overrides it. There is nothing left to bump before tagging.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
FernandoJVideira merged commit 7285594f3c into main 2026-10-08 23:11:42 +00:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: FernandoJVideira/draft#12