Reputation: 10675
On Azure DevOps, I have some files I want to publish:
$(Build.ArtifactStagingDirectory)/dist/app/index.html
$(Build.ArtifactStagingDirectory)/dist/app/bundle.js
I want to publish them into an artifact app.zip
which contains, at the root level:
- index.html
- bundle.js
However when I use the "Publish Build Artifacts" tasks with the path set to $(Build.ArtifactStagingDirectory)/dist/app
, I get the following contents in app.zip
:
app/
index.html
bundle.js
I tried setting the publish path to:
$(Build.ArtifactStagingDirectory)/dist/app/**
$(Build.ArtifactStagingDirectory)/dist/app/*
$(Build.ArtifactStagingDirectory)/dist/app/*.*
but all of these fail the build with the error Not found PathtoPublish
Upvotes: 2
Views: 1738
Reputation: 11
I am currently at the same crossroad as OP. The above answer does not work. What worked for me:
includeRootFolder
set to false
PathtoPublish
, use the same input given at the archive taskExample:
- task: ArchiveFiles@2
inputs:
rootFolderOrFile: '$(Build.ArtifactStagingDirectory)\dist\app'
includeRootFolder: false
archiveType: 'zip'
archiveFile: '$(Build.ArtifactStagingDirectory)\app.zip'
- task: PublishBuildArtifacts@1
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)\app.zip'
ArtifactName: 'drop'
publishLocation: 'Container'
Note: This example will mean that the published artifact with the name 'drop' will be available. If you download that, you will get a drop.zip file as the downloaded file. Instead of that, you should open the folder and download the zip folder already set in the drop folder.
Cheers.
Upvotes: 1
Reputation: 1
if I understand your question , you trying to publish 2 files as your atficats. as you are already ready with app.zip may be first retry copying it to another staging folder and then try to copy it from there. or see the below pattern to traverse through the directories. then you need - task: PublishBuildArtifacts inputs:
pathtoPublish: $(Build.ArtifactStagingDirectory)/**/*
artifactName: MyBuildOutputs
Cheers. AJ
Upvotes: -1