The goal is to provide a simple way to automatically calculate a Semantic Version for projects that are delivered frequently enough to not be able to handle versioning manually but not frequent enough to be able to utilize Continous Deployment.
It's possible to use it via the gradle plugin or the cli, see section below!
The easiest way is to use the gradle plugin, see the sample
folder for more information.
There are function tests for the plugin that explains the different configuration options.
cdcalc {
versionFile = file('.version')
}
The CLI is experimental but can be used for debugging at the moment.
./gradlew installDist
./cli/build/install/cli/bin/cli
The cli
or cli.bat
to can be executed from any folder containing a .git
folder
From time to time it's not possible to deploy to production any given time and to support a flow where a release branch can be stabilized and tested in a verification environment at the same time as a hotfix can be developed with blocking the ordinary development flow this might be an option.
master tag[v2.1.3] => 2.1.3
develop 2 commits ahead of latest reachable rc.0 tag tag[v1.2.3-rc.0] => 1.3.0-beta.2
release/2.0.0 => 2.0.0-rc.{numberOfFirstParentCommitsSinceDevelop} (this can be used for auto tagging)
hotfix/1.1.0 => 1.1.0-rc.{numberOfFirstParentCommitsSinceMaster} (this can be used for auto tagging)
merge-requests/137 => same base version resolver and bumping rules as develop => 1.1.0-alpha.137
undefined branch => throws a not supported exception
CDCalc was started a way to learn kotlin and also is heavliy inspired by the simplicity of GitVersion and if you have the possiblity you should use GitVersion instead.
CDCalc is also taking a much easier route to handle versioning of GitFlow since it requires a pre-release tag at the development branch together with the creation of a release branch. Given that tradeoff the logic to calculate the version is much easier.