Last active
December 18, 2015 12:28
-
-
Save wurmr/5782746 to your computer and use it in GitHub Desktop.
Powershell Script for Team City to extract a clean branch name for a repo using git flow
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$long_branch_name = "%teamcity.build.branch%" | |
# Branch Name | |
if ($long_branch_name.Contains("develop") -or $long_branch_name.Contains("feature")) | |
{ | |
$clean_branch_name = $long_branch_name.Substring($long_branch_name.LastIndexOf('/') + 1) | |
"##teamcity[setParameter name='Branch Name' value='-$clean_branch_name']" | |
} | |
else | |
{ | |
"##teamcity[setParameter name='Branch Name' value='']" | |
} | |
# Deploy Target | |
if ($long_branch_name.Contains("develop")) | |
{ | |
"##teamcity[setParameter name='Deploy Environment' value='Development']" | |
} | |
else | |
{ | |
"##teamcity[setParameter name='Deploy Environment' value='']" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Cleaning branches like a boss.