Search code examples
azure-devopssemantic-versioninggitversion

Increment GitVersion per build


Talking about UseGitVersion@5 Azure DevOps task, which is a wrapper around the actual GitVersion tool. I looked at the various GitVersion configuration options, but I could not find anything that will increment per build. Not per commit, per build. I have a build counter value I can pass to GitVersion, if it would be willing to accept it somehow, but I don't see any argument or option to use it.

The only option I found so far is to override the next-version value in GitVersion.yml, but I would prefer to increment the PreReleaseTag rather than the semver.


Solution

  • You can include environment variables in the various *-format properties in GitVersion.yml through the {env:ENVIRONMENT_VARIABLE} syntax.