dotnet / Nerdbank.GitVersioning

Stamp your assemblies, packages and more with a unique version generated from a single, simple version.json file and include git commit IDs for non-official builds.
https://www.nuget.org/packages/Nerdbank.GitVersioning
MIT License
1.36k stars 166 forks source link

Support using tags as only source for version #1041

Closed mortenn closed 6 months ago

mortenn commented 6 months ago

Thanks for your efforts thus far!

It would be great if I could use this tool in pipelines without needing to add additional artifacts to the tree.

To this end, I would like to see the tool read tags in the tree, and combine that with "git height" to spit out a version number.

Say the commit is tagged v1.0.0; version should then simply be 1.0.0
Another commit is made, the version would then become 1.0.1

Cheers, Morten

AArnott commented 6 months ago

That would lead to one commit building as one version one day, and as another version another day, merely due to the addition of a tag to the repo. That runs counter to the NB.GV philosophy, which is that a given commit only produces one (or two, due to the PublicRelease flag) version.

But there is a community out there that wants what you're asking for. I suggest they use GitVersion, which uses branch names, tag names, and PR environment variables to compute the version.