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 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 a 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, then choosing 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 3 numeric components,
Major.Minor.Patch. When you fix a bug, you increment the patch (
1.0.1). When you release a new backwards-compatible feature, you increment minor and reset patch to 0 (
1.5.0). When you make a backwards-incompatible change, you increment major and reset minor and patch to 0 (
The Universal Packages task will automatically select the next major, minor, or patch version for you when you publish a new package - just set the appropriate radio button
In the Universal Packages snippet you added above, 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 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 is to 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||The name of a service connection to another Azure DevOps organization or server. See service connections.|
|feedDownloadExternal||Feed that the package is to be downloaded from.|
|packageDownloadExternal||Name of the package to be downloaded.|
|versionDownloadExternal||Version of the package to be downloaded.|