Created
January 30, 2020 21:43
-
-
Save sqldeployhelmet/550e6532fc78a8f014bc950f27e0c6c7 to your computer and use it in GitHub Desktop.
PS Code for Dynamically setting a build number.
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
# The build number format is YYYY.MM.B (Year.Month.BuildCounter) | |
$MonthCounter = ([DateTime]::Now.Month).ToString().PadLeft(2, "0") | |
$YearCounter = ([DateTime]::Now.Date.Year).ToString() | |
$DayCounter = ([DateTime]::Now.Day).ToString().PadLeft(2, "0") | |
$TimeCounter = ([DateTime]::Now.Hour).ToString().PadLeft(2, "0") | |
$MinuteCounter = ([DateTIme]::Now.Minute).ToString().PadLeft(2, "0") | |
$counter = "$YearCounter.$MonthCounter.$DayCounter.$TimeCounter" + $MinuteCounter | |
<# writing the build number back to the host to overwrite the variable for Team City #> | |
Write-Host "##teamcity[buildNumber '$counter']" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
heads-up! you could do this with one line