Skip to content

azdo-pipelines: Publish NPM release to internal feed in addition to npmjs.org#2335

Draft
bwateratmsft wants to merge 10 commits into
mainfrom
bwateratmsft/npm-release-internal-feed
Draft

azdo-pipelines: Publish NPM release to internal feed in addition to npmjs.org#2335
bwateratmsft wants to merge 10 commits into
mainfrom
bwateratmsft/npm-release-internal-feed

Conversation

@bwateratmsft

@bwateratmsft bwateratmsft commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

TODO

Summary

Updates the NPM release template (azdo-pipelines/1es-mb-release-npm.yml) to optionally publish the released package to an internal Azure Artifacts feed, in addition to the existing ESRP/MicroBuild publish to npmjs.org.

Changes

  • Added an optional feedBaseUrl parameter (the Azure Artifacts feed base URL, e.g. https://devdiv.pkgs.visualstudio.com/DevDiv/_packaging/azcode). When set, the same tarball is also published to that feed.
  • The internal-feed publish runs after the ESRP publish to npmjs.org has completed successfully (ESRP uses waitForReleaseCompletion: true, and the new steps run sequentially after it).
  • Factored the .npmrc creation + npmAuthenticate@0 logic shared with setup.yml into a reusable azdo-pipelines/templates/write-npmrc-auth.yml. It respects a checked-in .npmrc when present, otherwise writes one with registry=<feedBaseUrl>/npm/registry/.
  • Same-org Azure Artifacts feeds authenticate with the build identity, so no service connection is required — none is added.
  • The same dryRun compile-time guard applies to the internal-feed publish.
  • Publishes the exact pre-built tarball via an Npm@1 task (command: custom, publish "$(tgzFileName)" --ignore-scripts), so the task handles exit-code failures and no lifecycle/build scripts run in the release pool.
  • Documented feedBaseUrl and the Feed Publisher (Contributor) permission requirement (publish permission is not automatic even for same-org feeds) in README.md.

Notes

Draft PR for review before merge. Note: a service connection is intentionally not included — cross-org/external feeds are out of scope, and same-org feeds authenticate via the build identity.

Add an optional npmFeed parameter to the 1es-mb-release-npm template. When set, the same tarball is published to the internal Azure Artifacts feed after the ESRP publish to npmjs.org succeeds, guarded by the same dryRun check. A same-org feed authenticates via the build identity through npmAuthenticate@0; an optional npmReleaseServiceConnection parameter covers external/cross-org feeds.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings June 10, 2026 14:20

This comment was marked as resolved.

bwateratmsft and others added 7 commits June 10, 2026 10:25
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Factor the .npmrc creation + npmAuthenticate@0 logic out of setup.yml and the NPM release template into a reusable templates/write-npmrc-auth.yml that derives the registry from either feedBaseUrl or npmFeed (+ System.CollectionUri).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Per code review, pass feedBaseUrl through to the NPM release template instead of npmFeed, and simplify write-npmrc-auth.yml to derive the registry solely from feedBaseUrl (dropping the System.CollectionUri-based npmFeed derivation).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@bwateratmsft bwateratmsft requested a review from Copilot June 10, 2026 14:49
@bwateratmsft bwateratmsft changed the title Publish NPM release to internal feed in addition to npmjs.org azdo-pipelines: Publish NPM release to internal feed in addition to npmjs.org Jun 10, 2026

This comment was marked as resolved.

bwateratmsft and others added 2 commits June 12, 2026 09:32
Check the working directory first, then the repo root (Build.SourcesDirectory), for a checked-in .npmrc, mirroring the .nvmrc lookup in setup.yml. The resolved path is threaded to npmAuthenticate@0 via a runtime npmrcFile variable so the token is injected into whichever file was found. In the release job (checkout: none) the repo-root path simply doesn't exist, so behavior there is unchanged.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants