Publish npm packages
Azure Pipelines | TFS 2018 | TFS 2017
In Microsoft Team Foundation Server (TFS) 2018 and previous versions, build and release pipelines are called definitions, service connections are called service endpoints, stages are called environments, and jobs are called phases.
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 an external npm registry, you must first create a service connection to point to that feed. You can do this by going to Project settings, selecting Services, and then creating a New service connection. Select the npm option for the service connection. Fill in the registry URL and the credentials to connect to the registry.
To publish a package to an 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.
The build does not support using the
publishConfig property to specify the
registry to which you're publishing. Ensure that your working folder has an
.npmrc file with a
registry= line, as detailed in the Connect to feed screen in your feed.