How can I build a git tag in TeamCity?

js3dev picture js3dev · Dec 3, 2013 · Viewed 29.6k times · Source

I want to provide a git tag to the TeamCity server to build it. I pass the tag (i.e. release_1.1) as a parameter to the job. So inside the job the tag is available as %tag%, but under the Version Control Settings I don't see any way to use this parameter so the server can checkout this tag. Is there any way this parameter can be used in the settings to checkout the tag?

Answer

Michel Samia picture Michel Samia · Jan 20, 2015
  1. Go to Edit Configuration Settings -> Version Control Settings
  2. For all your VCS roots for this build configuration click Edit and then:

    1. put '+:refs/tags/*' into Branch specification textbox
    2. check Use tags as branches

Then you'll be able to choose a tag when you press the '...' button beside run.