Publish and download Universal Packages in Azure Pipelines
Universal Packages are currently in public preview.
When you want to publish a set of related files from a pipeline as a single package, you can use Universal Packages hosted in Azure Artifacts feeds.
Prepare your Universal Package
Universal Packages are created from a directory of files. By default, the Universal Packages task will publish all files in
$(Build.ArtifactStagingDirectory). To prepare your Universal Package for publishing, either configure preceding tasks to place output files in that directory, or use the Copy Files utility task to assemble the files that you want to publish.
Publish your packages
To publish a Universal Package to your feed, add the following snippet to your azure-pipelines.yml file.
- task: UniversalPackages@0 displayName: Universal Publish inputs: command: publish publishDirectory: '$(Build.ArtifactStagingDirectory)' vstsFeedPublish: '<Feed name>' vstsFeedPackagePublish: '<Package name>' packagePublishDescription: '<Package description>'
To publish to an Azure Artifacts feed, set the Project Collection Build Service identity to be a Contributor on the feed. To learn more about permissions to Package Management feeds, see Secure and share packages using feed permissions.
To publish to an external Universal Packages feed, you must first create a service connection to point to that feed. You can do this by going to Project settings, selecting Service connections, and then creating a New Service Connection. Select the Team Foundation Server/Team Services option for the service connection. Fill in the feed URL and a personal access token to connect to the feed.
In Universal Packages, a particular package is identified by its name and version number. Currently, Universal Packages require Semantic Versioning. Semantic version numbers have three numeric components,
Major.Minor.Patch. When you fix a bug, you increment the patch (
1.0.1). When you release a new backward-compatible feature, you increment the minor version and reset the patch version to 0 (
1.5.0). When you make a backward-incompatible change, you increment the major version and reset the minor and patch versions to 0 (
The Universal Packages task automatically selects the next major, minor, or patch version for you when you publish a new package. Just set the appropriate option.
In the Universal Packages snippet that you added previously, add the
versionOption key with the
custom value. If you enter the
custom value, you must also provide the
- task: UniversalPackages@0 displayName: Universal Publish inputs: command: publish publishDirectory: '$(Build.ArtifactStagingDirectory)' vstsFeedPublish: '<Feed GUID>' vstsFeedPackagePublish: '<Package name>' versionOption: custom versionPublish: <Package version> packagePublishDescription: '<Package description>'
Download a Universal Package
You can also download a Universal Package from your pipeline.
To download a Universal Package from a feed in your organization, use the following snippet:
steps: - task: UniversalPackages@0 displayName: 'Universal download' inputs: command: download vstsFeed: 'fabrikamFeed' vstsFeedPackage: 'fabrikam-package' vstsPackageVersion: 1.0.0
|vstsFeed||Feed that the package will be downloaded from.|
|vstsFeedPackage||Name of the package to be downloaded.|
|vstsPackageVersion||Version of the package to be downloaded.|
To download a Universal Package from an external source, use the following snippet:
steps: - task: UniversalPackages@0 displayName: 'Universal download' inputs: command: download feedsToUse: external externalFeedCredentials: MSENG2 feedDownloadExternal: `fabrikamFeedExternal` packageDownloadExternal: `fabrikam-package` versionDownloadExternal: 1.0.0
|feedsToUse||Value should be
|externalFeedCredentials||Name of a service connection to another Azure DevOps organization or server. See service connections.|
|feedDownloadExternal||Feed that the package will be downloaded from.|
|packageDownloadExternal||Name of the package to be downloaded.|
|versionDownloadExternal||Version of the package to be downloaded.|
Where can I learn more about Azure Artifacts and the TFS Package Management service?