Get current Timestamp and concatenate with string in 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'

enter image description here