Get latest tag from GIT

I have been trying to find a plugin to get the current tag on my branch so I can use it as part of my build as a parameter to msbuild.
We want to use this tag to version dlls.

3 comments
Comment actions Permalink

Hi Dario,

You can get Git tag using git commands in your build script. For example, see this link, the currently used revision is specified by the build.vcs.number build parameter.

0
Comment actions Permalink

Thanks! So I can use git describe to set the variable and pass it thorught the messaging system to set the complete dll version.
Something like

$last_tag = git describe --exact-match %env.BUILD_VCS_NUMBER%

##teamcity[gitDescribeExecuted tag='%
last_tag
%']

##teamcity[setParameter name='
gitTag
'
 
value='{last_tag}']


and I can use gitTag as part of my build script
Is this correct?
0
Comment actions Permalink

Yes, it will work (except this line 

##teamcity[gitDescribeExecuted tag='%
last_tag
%']
) in case of agent side checkout.
0

Please sign in to leave a comment.