Skip to content

build: single-source the version in a VERSION file - #25

Merged
nmatt0 merged 1 commit into
masterfrom
feat/version-single-source
Sep 17, 2026
Merged

nmatt0 merged 1 commit into
masterfrom
feat/version-single-source

Conversation

@nmatt0

@nmatt0 nmatt0 commented Sep 17, 2026

Copy link
Copy Markdown
Owner

Summary

Make a top-level VERSION file the single source of truth for the version.

Why

The version was duplicated across CMakeLists.txt (project(VERSION ...)),
package.nix (the Nix flake), and debian/changelog, with nothing keeping
them in sync. A release bump could update one and miss another, shipping a
mislabeled artifact.

What

  • VERSION (new, repo root) holds the number once (0.2.1).
  • CMakeLists.txt reads it with file(STRINGS) and passes it to
    project(), so MITHRIL_VERSION still flows from PROJECT_VERSION.
  • package.nix reads the same file with lib.fileContents.
  • .github/workflows/release.yml gains a Version consistency step. CMake
    and Nix derive from VERSION and cannot drift; debian/changelog and the
    git tag carry the number independently, so the release fails if either
    disagrees with VERSION rather than publishing a mislabeled build.

debian/changelog is intentionally not derived: dpkg needs a literal, and the
file carries its own -N Debian revision plus changelog history. The CI guard
keeps it honest instead.

Release flow after this

Edit VERSION, add a debian/changelog stanza, tag v<VERSION>.

Testing

  • Verified the version flows end to end: temporarily setting VERSION to a
    different value makes mithril --version report it; restored to 0.2.1.
  • The Version consistency parse extracts the upstream version from
    debian/changelog and matches VERSION.
  • Full unit + integration suite green.

The version was duplicated across CMakeLists.txt (project(VERSION ...)),
package.nix (the Nix flake added recently), and debian/changelog, with nothing
keeping them in sync, so a release bump could easily ship a mislabeled artifact.

Introduce a top-level VERSION file as the single source of truth:

- CMakeLists.txt reads it via file(STRINGS) and passes it to project(), so
  MITHRIL_VERSION still flows from PROJECT_VERSION.
- package.nix reads the same file via lib.fileContents.

debian/changelog cannot derive its value (dpkg needs a literal and it carries
its own -N Debian revision plus changelog history), so the release workflow
gains a Version consistency step that fails the build if the git tag or
debian/changelog upstream version disagrees with VERSION. CMake and Nix derive
from VERSION and cannot drift.

Cutting a release is now: edit VERSION, add a debian/changelog stanza, tag
v<VERSION>. Verified the version flows end to end (binary reports VERSION) and
the full suite stays green.
@nmatt0
nmatt0 merged commit 88121d2 into master Sep 17, 2026
4 checks passed
@nmatt0
nmatt0 deleted the feat/version-single-source branch September 17, 2026 17:34
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.

1 participant