Change TeamCity package number based on branch

I am using GIT for source control, TeamCity to build packages, and octopus to deploy. I am having an issue with numbering the packages. I would like to have a numbering scheme like 1.1.5656 where the second number is controlled by whether the current build is the master branch. So when I check into a branch were I am working on a new feature it has a lower number than the master branch like 1.0.5657. Does anyone have an Idea of how to do this? I suspect the TeamCity might have something to do with the solution.

1 comment
Comment actions Permalink


It's impossible to make in UI. You need to add a new build step (for example command line runner), check if branch is default or not, and then set build number using ##teamcity[buildNumber '%build.counter%.1'] service message. For example:

if [ = "true" ]; then
   echo "##teamcity[buildNumber '%build.counter%.1']"
   echo "##teamcity[buildNumber '%build.counter%.0'] "


Please sign in to leave a comment.