Peter
Peter

Reputation: 1687

azure devops: copy and publish build artifacts - rename artifact by buildnumber

I want to know how to change the Artifact Name with a build variable. My preferred result would be

MyApplication_[My Build Number]

How can i achieve this. In the picture below are my current settings.

enter image description here

Upvotes: 1

Views: 1871

Answers (2)

klreeher
klreeher

Reputation: 1615

Just a note on this solution, this is setting the artifact's name, not the file(s) included in the artifact. If you set

         - task: PublishPipelineArtifact@1
          inputs:
            targetPath: 'targetPath'
            artifact: ' ArtifactName_$(Build.BuildNumber)'
            publishLocation: 'pipeline'

you'll see an artifact published named ArtifactName_$(Build number....) but the contents of the folder will be unchanged in name.

Upvotes: 1

jessehouwing
jessehouwing

Reputation: 114641

As artifact name, enter

 ArtifactName_$(Build.BuildNumber)

Upvotes: 2

Related Questions