Publish Pipeline Artifacts task

Azure Pipelines

Use this task in a pipeline to publish artifacts for the Azure Pipeline (note that publishing is NOT supported in release pipelines. It is supported in multi stage pipelines, build pipelines, and yaml pipelines).

Tip

Looking to get started working with build artifacts? See Artifacts in Azure Pipelines.

Demand

None

YAML snippet

# Publish pipeline artifacts
# Publish (upload) a file or directory as a named artifact for the current run
- task: PublishPipelineArtifact@1
  inputs:
    #targetPath: '$(Pipeline.Workspace)' 
    #artifactName: # 'drop'

Arguments

Argument Description
targetPath Path to the folder or file you want to publish. The path must be a fully-qualified path or a valid path relative to the root directory of your repository. See Artifacts in Azure Pipelines.
artifactName Specify the name of the artifact that you want to create. It can be whatever you want. For example: drop
Control options

Open source

This task is open source on GitHub. Feedback and contributions are welcome.

Q & A

Q: I'm having problems. How can I troubleshoot them?

A: Try this:

  1. On the variables tab, add system.debug and set it to true. Select to allow at queue time.

  2. In the explorer tab, view your completed build and click the build step to view its output.

The control options arguments described above can also be useful when you're trying to isolate a problem.

Q: How do variables work? What variables are available for me to use in the arguments?

A: $(Build.SourcesDirectory) and $(Agent.BuildDirectory) are just a few of the variables you can use. Variables are available in expressions as well as scripts; see variables to learn more about how to use them. There are some predefined build and release variables you can also rely on.