Using an OctopusDeploy: Create Release
runner in TeamCity, I can create a release with the build.number
fairly easily.
I'd like to add a suffix of the git commit short hash.
Here is how I solved it - scraped from various internet sources
In my CI Build, I added
system.GitHashShort
Created a Powershell runner which executes this
$hash = "%build.vcs.number%"
$shortHash = $hash.substring(0,7)
Write-Host "##teamcity[setParameter name='system.GitHashShort' value='$shortHash']"
In my Deploy build configuration which is a snapshot dependency on CI Build
OctopusDeploy: Create Release
runner, set the release number to be
%build.number%-%dep.MyAwesomeApp.system.GitHashShort%
This then gives builds of a format like 8.3.422.34-deadbee