Publish npm packages
Azure Pipelines | TFS 2018 | TFS 2017
Build and release pipelines are called definitions in TFS 2018 and in older versions. Service connections are called service endpoints in TFS 2018 and in older versions.
You can publish npm packages produced by your build to:
- Azure Artifacts or the TFS Package Management service
- Other registries such as
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 npm registry, you must first create a service connection to point to that feed. You can do this by going to Project settings, then choosing Services, and then creating a New service connection. Select the npm option for the service connection. Fill in registry URL and the credentials to connect to the registry.
To publish a package to a npm registry, add the following snippet to your azure-pipelines.yml file.
- task: Npm@1 inputs: command: publish publishEndpoint: '<copy and paste the name of the service connection here>'
For a list of other options, see the npm task.
YAML is not supported in TFS.
Build does not support using the
publishConfig property to specify the
registry to which you're publishing. Ensure your working folder has a
.npmrc file with a
registry= line, as detailed in the Connect to feed screen in your feed.