How to increment version when my plan executes?

Arpan Mehetre March 29, 2018

I have a c# library which gets build and published to our package repository through a bamboo plan each time we update it in Bitbucket.

I have a plan level variable "version = 1.0.0".

I want to be able to update the value of this variable every time the plan runs. It should - 

  • Pick up the existing version of library(e.g., 1.0.0 or 1.0.1 etc...)
  • Increment it by 1(e.g., 1.0.2)
  • And then this variable should be available for next task in the plan which is responsible for publishing the library to package repository

I have the task type -  "Version Variable Incrementer" but there is not enough documentation(that I can find) on how to use that.

Please help. Thanks.

1 answer

0 votes
Cristiano Mariano
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 5, 2018

Hi Arpan! How are you doing?

We did something similar to this using the variable ${bamboo.buildNumber}.

You could still have a variable called version with value 1.0 and pass "${bamboo.version}.${bamboo.buildNumber}" as a parameter to your tasks.

As this value will be the same during the entire build, you can use this expression anywhere you want, so you would't have to care about passing it between tasks.

Hope this helps!

Cristiano

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events