Use Git tag in build version
Answered
I would like to use the latest Git tag in my build number. For example, if my latest Git tag is '1.9.2' and my build counter is 50, I would like the build number to be 1.9.2.50. I know I can use "git describe --abbrev=0 %build.vcs.number%" in a build step to get the latest Git tag, but I can't quite figure out how to get that value into the build number.
Please sign in to leave a comment.
Hello!
Please refer to BuildScriptInteractionwithTeamCity-ReportingBuildNumber on how to change Build parameters from Build Step.
E.g. you should write a cmdline Build Step to define the variable as git command output and print it as Service Message:
on Windows:
on Linux:
BTW,
If you use tags as branches in Git, then it can be much simplier - define Build number format as
in Build Configuration | General Settings.