Events
Mar 17, 9 PM - Mar 21, 10 AM
Join the meetup series to build scalable AI solutions based on real-world use cases with fellow developers and experts.
Register nowThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Azure DevOps Services | Azure DevOps Server 2022 - Azure DevOps Server 2019
With Azure Pipelines, you can publish your npm packages to Azure Artifacts feeds within your organization and in other organizations. This article will guide you through publishing your npm packages to internal and external feeds using YAML and Classic pipelines.
Create an Azure DevOps organization and a project if you haven't already.
Create a new feed if you don't have one already.
If you're using a self-hosted agent, make sure that it has Node.js and npm.
Note
To publish your packages to a feed using Azure Pipelines, ensure that both the Project Collection Build Service and your project's Build Service identity are configured as a Feed Publisher (Contributor). See Add new users/groups for more details.
steps:
- task: NodeTool@0
inputs:
checkLatest: true
- task: npmAuthenticate@0
displayName: 'Authenticate to Azure Artifacts feed'
inputs:
workingFile: .npmrc
- script: |
npm publish
displayName: Publish
To publish your packages to a feed in another Azure DevOps organization, you must first create a personal access token in the target organization.
Navigate to the organization hosting your target feed and Create a personal access token with Packaging > Read & write scope. Copy your personal access token as you'll need it in the following section.
Sign in to the Azure DevOps organization where your pipeline will run, and then navigate to your project.
Navigate to your Project settings > Service connections.
Select New service connection, select npm, and then select Next.
Select Username and Password as the Authentication method, and then enter your Registry URL. Enter your Username (a placeholder, as Azure Pipelines will use your .npmrc
configuration file and the personal access token you created earlier to authenticate). For Password, paste your personal access token. Provide a name for your service connection, and check the Grant access permission to all pipelines checkbox.
Select Save when you're done.
Sign in to your Azure DevOps organization, and then navigate to your project.
Select Pipelines, and then select your pipeline definition.
Select Edit, and then add the following snippet to your YAML pipeline.
- task: NodeTool@0
inputs:
checkLatest: true
- task: npmAuthenticate@0
displayName: 'Authenticate to Azure Artifacts feed'
inputs:
workingFile: .npmrc
customEndpoint: <SERVICE_CONNECTION_NAME>
- script: |
npm publish
displayName: Publish
Events
Mar 17, 9 PM - Mar 21, 10 AM
Join the meetup series to build scalable AI solutions based on real-world use cases with fellow developers and experts.
Register nowTraining
Module
Manage build dependencies with Azure Artifacts - Training
In this module, the Space Game web team guides you through creating a build pipeline that produces a package that can be used by multiple applications.
Certification
Microsoft Certified: DevOps Engineer Expert - Certifications
This certification measures your ability to accomplish the following technical tasks: Design and implement processes and communications, design and implement a source control strategy, design and implement build and release pipelines, develop a security and compliance plan, and implement an instrumentation strategy.
Documentation
npmAuthenticate@0 - npm authenticate (for task runners) v0 task
Don't use this task if you're also using the npm task. Provides npm credentials to an .npmrc file in your repository for the scope of the build. This enables npm task runners like gulp and Grunt to authenticate with private registries.
Publish and download npm packages - Azure Artifacts
Learn how to set up your project to manage your npm packages in Azure Artifacts.
Install and publish npm packages, or run an npm command. Supports npmjs.com and authenticated registries like Azure Artifacts.