Skip to content

Instantly share code, notes, and snippets.

@mbenford
Created August 11, 2014 01:12
Show Gist options
  • Save mbenford/e306ff83ff0a70799e14 to your computer and use it in GitHub Desktop.
Save mbenford/e306ff83ff0a70799e14 to your computer and use it in GitHub Desktop.
Powershell script for TeamCity that sets some parameters to be used with Octopus Deploy based on the current branch
function Is-Default-Branch {
return "%teamcity.build.branch.is_default%" -eq "true"
}
function Set-TeamCity-Parameter($name, $value) {
Write-Host "##teamcity[setParameter name='$name' value='$value']"
}
if (Is-Default-Branch) {
$releaseNumber = "%octopus.master.releaseNumber%"
$deployTo = "%octopus.master.deployTo%"
$packageVersion = "%octopus.master.packageVersion%"
}
else {
$releaseNumber = "%octopus.release.releaseNumber%"
$deployTo = "%octopus.release.deployTo%"
$packageVersion = "%octopus.release.packageVersion%"
}
Set-TeamCity-Parameter "octopus.releaseNumber" $releaseNumber
Set-TeamCity-Parameter "octopus.packageVersion" $packageVersion
Set-TeamCity-Parameter "octopus.deployTo" $deployTo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment