DeVOps Build Format Name

38 Views Asked by At

How to add current week number in Pipeline Build name?

  1. tried -> $(Date:ww) #its not system in build function

2)Tried -> $week = "{0:d1}" -f ($(Get-Culture).Calendar.GetWeekOfYear((Get-Date),[System.Globalization.CalendarWeekRule]::FirstFourDayWeek, [DayOfWeek]::Monday))

Write-Host "##vso[task.setvariable variable=$($WeekNumber)]$($week )"

1

There are 1 best solutions below

0
On

I resolved the issue, Thank you all

$year=$(Get-Date -Format yy)
$date=$(Get-Date -Format yyyyMMdd)
$week = "{0:d1}" -f ($(Get-Culture).Calendar.GetWeekOfYear((Get-Date),[System.Globalization.CalendarWeekRule]::FirstFourDayWeek, [DayOfWeek]::Monday)) 

Write-Host "##vso[build.updatebuildnumber]$year.1.$week+$date"