Setting up a yml based azure build pipeline for which publishing artifacts require timestamp based name. Trying to do something like this
'ArtifactName' + currentTimeStamp
How can this be done in an yml file?
This should give you expected result:
trigger:
- master
pool:
vmImage: ubuntu-latest
steps:
- pwsh: |
Write-Host "Setting up the date time for build variable"
$date=$(Get-Date -format yyyyMMdd-Hmmss)
Write-Host "##vso[task.setvariable variable=currentTimeStamp]$date"
displayName: 'Geting timestamp'
- task: PublishPipelineArtifact@1
inputs:
targetPath: '$(Pipeline.Workspace)'
artifact: 'ArtifactName-$(currentTimeStamp)'
publishLocation: 'pipeline'

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With