In a previous post, I wrote about GitVersion. GitVersion is a tool which solves semantic versioning of a git repository in its own way. With GitVersion, the version of any git repository is a pure function of its state, derived by tags, branches and commit messages.
GitVersion is built on .NET Framework (not .NET Core). Running it on a modern CI environment is possible, as a Docker image is available. For example, to see the semantic version of a repo you can run:
docker run --rm \ -v $(pwd):/repo \ gittools/gitversion /showvariable SemVer
The only problem is that the official image is a bit large, weighing in at 493MB.
I’ve managed to slim that down significantly at 85MB, by installing only the necessary mono libraries (with some trial and error).
docker run --rm \ -v $(pwd):/repo \ ngeor/gitversion /showvariable SemVer
This makes it a bit easier to use this tool. However, porting it to .NET Core might be a better solution overall.