This plugin allows the calculation of the project version based on git tags and commits.
plugins {
id("de.solugo.gitversion") version "..."
}
-
gitVersionPrintBuildInfo : Prints the build information generated by gitVersion
-
gitVersionCreatePropertiesFile : Creates a file containing the generated version. By default the file
build/VERSION
is generated. -
gitVersionCreateVersionFile : Creates a resource properties file containing the build information. By default the file
build/resources/main/gitVersion.properties
is generated.
The version value that triggers the calculation of a git based version.
The base version used for the calculation of a git based version.
The regex pattern used on tag name to identify a version tag.
The regex pattern used on commit message to identify a major version bump.
The regex pattern used on commit message to identify a minor version bump.
The regex pattern used on commit message to identify a patch version bump.
Version qualifier to be appended to the calculated version
-
auto
: If there are uncommited changesSNAPSHOT
is added as qualifier. -
hash
: If there are uncommited changesSNAPSHOT
or else the commit hash is added as qualifier. -
none
: No qualifier will be added.
Build pipeline handling to be applied
-
auto
: Current build pipeline is identified automatically -
azure
: Azure build pipeline modifications are applied if possible -
github
: GitHub build pipeline modifications are applied if possible
VERSION 2.1.1
COMMIT "Second commit" <-- 0.0.2 (patch pattern)
COMMIT "First commit" <-- 0.0.1 (patch pattern)
INIT <-- 0.0.0 (base)
VERSION 2.1.1
COMMIT "Second commit" <-- 1.0.1 (patch pattern ^(.*)$)
TAG "v1.0.0" <-- 1.0.0 (tag pattern ^v(.+)$)
VERSION 2.1.1
COMMIT "Patch commit" <-- 2.1.1 (patch pattern ^Patch (.*)$)
COMMIT "Minor commit" <-- 2.1.0 (minor pattern ^Minor (.*)$)
COMMIT "Major commit" <-- 2.0.0 (major pattern ^Major (.*)$)
TAG "Version-1.0.0" <-- 1.0.0 (tag pattern ^Version-(.+)$)
VERSION 2.1.2-SNAPSHOT
MODIFICATION <-- 2.1.2-SNAPSHOT
COMMIT "Patch commit" <-- 2.1.1 (patch pattern ^Patch (.*)$)
COMMIT "Minor commit" <-- 2.1.0 (minor pattern ^Minor (.*)$)
COMMIT "Major commit" <-- 2.0.0 (major pattern ^Major (.*)$)
TAG "Version-1.0.0" <-- 1.0.0 (tag pattern ^Version-(.+)$)
VERSION 2.1.2-3af1a64
COMMIT "Patch commit" <-- 2.1.1 (patch pattern ^Patch (.*)$)
COMMIT "Minor commit" <-- 2.1.0 (minor pattern ^Minor (.*)$)
COMMIT "Major commit" <-- 2.0.0 (major pattern ^Major (.*)$)
TAG "Version-1.0.0" <-- 1.0.0 (tag pattern ^Version-(.+)$)