Skip to content

feat: Version the package with MinVer instead of a manual CI step - #10

Merged
henrikottesorensen merged 2 commits into
Notalib:mainfrom
henrikottesorensen:henrikottesorensen-add-minver-versioning
Aug 12, 2026
Merged

feat: Version the package with MinVer instead of a manual CI step#10
henrikottesorensen merged 2 commits into
Notalib:mainfrom
henrikottesorensen:henrikottesorensen-add-minver-versioning

Conversation

@henrikottesorensen

Copy link
Copy Markdown
Collaborator

Summary

Replaces the hand-maintained "take the version from the tag" CI step with MinVer, so the package version is always derived from the nearest git tag (and commit height above it) rather than a value that has to be kept in sync by hand.

Changes

  • Directory.Build.props (new): sets MinVerTagPrefix to v, matching this repo's v2.2.0-style tags.
  • Nota.CodeAnalysis.csproj: adds a PackageReference to MinVer (PrivateAssets="All", build-time only) and removes the hardcoded <Version>2.2.1</Version>.
  • .github/workflows/build-and-publish.yml: checkout now uses fetch-depth: 0 (MinVer needs tag history to compute height), and the manual "take the version from the tag" step plus $VERSION_ARG plumbing is removed — MinVer sets Version on every build automatically.
  • Nota.CodeAnalysis.Verification/verify-package.sh: switches from -p:Version to -p:MinVerVersionOverride. MinVer recalculates Version itself and would otherwise silently overwrite the -p:Version override, causing every verification run to collide on the same package version — the exact caching bug the script's own comment already warns about.

Verification

  • dotnet build/dotnet pack on the solution succeed, and pack correctly derives 2.2.1-alpha.0.1 off the current v2.2.0 tag (would be exactly 2.2.0 if built directly on that tag).
  • verify.sh, verify-encoding.sh, and verify-package.sh all pass.

henrikottesorensen and others added 2 commits August 12, 2026 20:27
MinVer computes Version from the nearest git tag (v-prefixed, per Directory.Build.props)
plus commit height, so packing by hand and CI publishing can no longer disagree, and the
workflow's own "take the version from the tag" step is now unnecessary.

verify-package.sh switches from -p:Version to -p:MinVerVersionOverride: MinVer recalculates
and overwrites Version itself, so -p:Version was silently ignored and every verification run
would have collided on the same package version - the exact bug that comment already warns
about.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
The "Working on this repository" section still described the version living in the tag
and a local-default <Version> in the csproj - true before this change, wrong after it now
that MinVer computes Version from the tag on every build and the property is gone.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@henrikottesorensen
henrikottesorensen merged commit 9b87ade into Notalib:main Aug 12, 2026
1 check passed
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