Muokkaa

Jaa


PublishBuildArtifacts@1 - Publish build artifacts v1 task

Use this task in a build pipeline to publish build artifacts to Azure Pipelines, TFS, or a file share.

If you're using Azure DevOps Services, we recommend using Download Pipeline Artifacts and Publish Pipeline Artifacts for faster performance.

Use this task in a build pipeline to publish build artifacts to Azure Pipelines, TFS, or a file share.

Syntax

# Publish build artifacts v1
# Publish build artifacts to Azure Pipelines or a Windows file share.
- task: PublishBuildArtifacts@1
  inputs:
    PathtoPublish: '$(Build.ArtifactStagingDirectory)' # string. Required. Path to publish. Default: $(Build.ArtifactStagingDirectory).
    ArtifactName: 'drop' # string. Required. Artifact name. Default: drop.
    publishLocation: 'Container' # 'Container' | 'FilePath'. Alias: ArtifactType. Required. Artifact publish location. Default: Container.
    #MaxArtifactSize: '0' # string. Max Artifact Size. Default: 0.
    #TargetPath: # string. Required when ArtifactType = FilePath. File share path. 
    #Parallel: false # boolean. Optional. Use when ArtifactType = FilePath. Parallel copy. Default: false.
    #ParallelCount: '8' # string. Optional. Use when ArtifactType = FilePath && Parallel = true. Parallel count. Default: 8.
  # Advanced
    #StoreAsTar: false # boolean. Tar the artifact before uploading. Default: false.
# Publish build artifacts v1
# Publish build artifacts to Azure Pipelines or a Windows file share.
- task: PublishBuildArtifacts@1
  inputs:
    PathtoPublish: '$(Build.ArtifactStagingDirectory)' # string. Required. Path to publish. Default: $(Build.ArtifactStagingDirectory).
    ArtifactName: 'drop' # string. Required. Artifact name. Default: drop.
    publishLocation: 'Container' # 'Container' | 'FilePath'. Alias: ArtifactType. Required. Artifact publish location. Default: Container.
    #TargetPath: # string. Required when ArtifactType = FilePath. File share path. 
    #Parallel: false # boolean. Optional. Use when ArtifactType = FilePath. Parallel copy. Default: false.
    #ParallelCount: '8' # string. Optional. Use when ArtifactType = FilePath && Parallel = true. Parallel count. Default: 8.
  # Advanced
    #FileCopyOptions: # string. Optional. Use when ArtifactType = FilePath. File copy options. 
    #StoreAsTar: false # boolean. Tar the artifact before uploading. Default: false.
# Publish build artifacts v1
# Publish build artifacts to Azure Pipelines or a Windows file share.
- task: PublishBuildArtifacts@1
  inputs:
    PathtoPublish: '$(Build.ArtifactStagingDirectory)' # string. Required. Path to publish. Default: $(Build.ArtifactStagingDirectory).
    ArtifactName: 'drop' # string. Required. Artifact name. Default: drop.
    publishLocation: 'Container' # 'Container' | 'FilePath'. Alias: ArtifactType. Required. Artifact publish location. Default: Container.
    #TargetPath: # string. Required when ArtifactType = FilePath. File share path. 
    #Parallel: false # boolean. Optional. Use when ArtifactType = FilePath. Parallel copy. Default: false.
    #ParallelCount: '8' # string. Optional. Use when ArtifactType = FilePath && Parallel = true. Parallel count. Default: 8.
  # Advanced
    #FileCopyOptions: # string. Optional. Use when ArtifactType = FilePath. File copy options.
# Publish build artifacts v1
# Publish build artifacts to Azure Pipelines or a Windows file share.
- task: PublishBuildArtifacts@1
  inputs:
    PathtoPublish: '$(Build.ArtifactStagingDirectory)' # string. Required. Path to publish. Default: $(Build.ArtifactStagingDirectory).
    ArtifactName: 'drop' # string. Required. Artifact name. Default: drop.
    publishLocation: 'Container' # 'Container' | 'FilePath'. Alias: ArtifactType. Required. Artifact publish location. Default: Container.
    #TargetPath: # string. Required when ArtifactType = FilePath. File share path. 
    #Parallel: false # boolean. Optional. Use when ArtifactType = FilePath. Parallel copy. Default: false.
    #ParallelCount: '8' # string. Optional. Use when ArtifactType = FilePath && Parallel = true. Parallel count. Default: 8.
# Publish Build Artifacts v1
# Publish build artifacts to Azure Pipelines/TFS or a file share.
- task: PublishBuildArtifacts@1
  inputs:
    PathtoPublish: '$(Build.ArtifactStagingDirectory)' # string. Required. Path to publish. Default: $(Build.ArtifactStagingDirectory).
    ArtifactName: 'drop' # string. Required. Artifact name. Default: drop.
    publishLocation: 'Container' # 'Container' | 'FilePath'. Alias: ArtifactType. Required. Artifact publish location. Default: Container.
    #TargetPath: # string. Required when ArtifactType = FilePath. File share path. 
    #Parallel: false # boolean. Optional. Use when ArtifactType = FilePath. Parallel copy. Default: false.
    #ParallelCount: '8' # string. Optional. Use when ArtifactType = FilePath && Parallel = true. Parallel count. Default: 8.

Inputs

PathtoPublish - Path to publish
string. Required. Default value: $(Build.ArtifactStagingDirectory).

Specifies the folder or file path to publish. This can be a fully qualified path or a path relative to the root of the repository. Wildcards are not supported. Variables are supported. Example: $(Build.ArtifactStagingDirectory). For more information, see Artifacts in pipelines - overview.


ArtifactName - Artifact name
string. Required. Default value: drop.

Specifies the name of the artifact to create in the publish location. The following special characters are not allowed: +, %, {, }


publishLocation - Artifact publish location
Input alias: ArtifactType. string. Required. Allowed values: Container (Azure Pipelines), FilePath (A file share). Default value: Container.

Specifies whether to store the artifact in Azure Pipelines (Container), or to copy it to a file share (FilePath) that must be accessible from the build agent. For more information, see Artifacts in Azure Pipelines.


publishLocation - Artifact publish location
Input alias: ArtifactType. string. Required. Allowed values: Container (Azure Pipelines/TFS), FilePath (A file share). Default value: Container.

Specifies whether to store the artifact in Azure Pipelines (Container), or to copy it to a file share (FilePath) that must be accessible from the build agent. For more information, see Artifacts in Azure Pipelines.


MaxArtifactSize - Max Artifact Size
string. Default value: 0.

Maximum limit on the size of artifacts to be published in bytes. Put 0 if you don't want to set any limit.


TargetPath - File share path
string. Required when ArtifactType = FilePath.

Specifies the path to the file share where you want to copy the files. The path must be a fully qualified path or a valid path relative to the root directory of your repository. Publishing artifacts from a Linux or macOS agent to a file share is not supported. Example: \\my\share\$(Build.DefinitionName)\$(Build.BuildNumber).


Parallel - Parallel copy
boolean. Optional. Use when ArtifactType = FilePath. Default value: false.

Specifies whether to copy files in parallel using multiple threads for greater potential throughput. If this setting is not enabled, a single thread will be used.


ParallelCount - Parallel count
string. Optional. Use when ArtifactType = FilePath && Parallel = true. Default value: 8.

Specifies the degree of parallelism (the number of threads) used to perform the copy. The value must be at least 1 and not greater than 128. Choose a value based on CPU capabilities of the build agent.


StoreAsTar - Tar the artifact before uploading
boolean. Default value: false.

Adds all files from the publish path to a tar archive before uploading. This allows you to preserve the UNIX file permissions. Use extractTars option of theDownloadBuildArtifacts task to extract the downloaded items automatically. This setting is ignored on Windows agents.


FileCopyOptions - File copy options
string. Optional. Use when ArtifactType = FilePath.

Passes additional options to the Robocopy command. For example, the recursive minimatch pattern **/*.


Task control options

All tasks have control options in addition to their task inputs. For more information, see Control options and common task properties.

Output variables

None.

Remarks

Note

You cannot use Bin, App_Data and other folder names reserved by IIS as an Artifact name because this content is not served in response to Web requests. Please see ASP.NET Web Project Folder Structure for more details.

Examples

steps:
- task: CopyFiles@2
  inputs:
    contents: '_buildOutput/**'
    targetFolder: $(Build.ArtifactStagingDirectory)
- task: PublishBuildArtifacts@1
  inputs:
    pathToPublish: $(Build.ArtifactStagingDirectory)
    artifactName: MyBuildOutputs

Requirements

Requirement Description
Pipeline types YAML, Classic build
Runs on Agent, DeploymentGroup
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Command restrictions Any
Settable variables Any
Agent version 1.91.0 or greater
Task category Utility

See also