If you want to create a new version for your package in bamboo, you can add the version git tag to your package in Bamboo with following steps:
- Add a script task in your build plan with following contents:
git_tag="$(git ls-remote --tags ${bamboo.planRepository.repositoryUrl} | cut -d/ -f3- | awk '/^[^{]*$/{version=$1}END{print version}')"
echo "git_tag=$git_tag" > git_tag.txt
This will strip the version tag from the git commit and added this to a txt file located in a working subdirectory package/apps/myapplication
- Next you’ll need to inject the version into Bamboo. you can do this by adding a task “Inject Bamboo Variables”:

Now we can reuse this bamboo variable in a build plan by adding ${bamboo.myapplication.git_tag}
Leave a Reply