I am using Cake scripts to build out my software in Azure DevOps through continuous integration. The requirement is that when we commit/merge into to the dev or master branch, the appropriate build pipeline(s) are kicked off. As part of this build we need to tag and version our software automatically. I have the following code in my cake script already to use GitVersion to add the semantic versioning to my build:
Task("Version")
.Does(() =>
{
Information("Versioning software for configuration {0} of {1}...", configuration, solution);
GitVersion(new GitVersionSettings {
UpdateAssemblyInfo = true,
OutputType = GitVersionOutput.BuildServer,
WorkingDirectory = toolsDirectory
});
GitVersion versionInfo = GitVersion(new GitVersionSettings{ OutputType = GitVersionOutput.Json });
Information("Semantic Version: " + versionInfo.AssemblySemVer);
Information("Full Semantic Version: " + versionInfo.AssemblySemFileVer);
Information("Informational Version: " + versionInfo.InformationalVersion);
});
I want the team lead or someone in authority to increment the major and minor build versions before this code is merged in with the branch. Or I want the pipeline to auto version the software and the eventual zip artifact we create at the end of the build pipeline.
So here are my questions:
- How do I automatically increment my version numbers and tags?
- Should I avoid auto incrementing?
- How do I add the version number to my artifact name in the Azure DevOps build process?
- What do I need to change in my git version code to use the tags?
- How do I add suffixes to make versioning and tagging more "git flow" like (such as "pre-release" and so on)?
I this is a bit broad, but I am struggling to find any examples of using git versioning and git tagging within Cake Build and connecting that to Azure DevOps in a meaningful way. Thanks in advance.