Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 6 additions & 10 deletions eng/common/pipelines/templates/jobs/npm-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,13 @@ jobs:
Write-Host "Publishing packages with tag: $tag"
displayName: 'Packages to be published'

- template: /eng/common/pipelines/templates/steps/create-authenticated-npmrc.yml
parameters:
npmrcPath: $(ArtifactPath)/.npmrc
registryUrl: ${{ parameters.Registry }}
CustomCondition: and(succeeded(), ne(variables['SkipPublishing'], 'true'))

Comment on lines +71 to +76
Copy link

Copilot AI Mar 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This template now creates an .npmrc under $(ArtifactPath), but the later npm view tag-verification step (in the npmjs.org branch) doesn’t run in $(ArtifactPath) and doesn’t pass --registry. With the previous reset-npmrc.yml step removed, tag verification can end up querying an unexpected registry depending on agent/repo npm config. Suggestion: either set workingDirectory: $(ArtifactPath) / NPM_CONFIG_USERCONFIG for the verification step, or pass --registry ${{ parameters.Registry }} to npm view so verification is deterministic.

Copilot uses AI. Check for mistakes.
- ${{ if eq(parameters.Registry, 'https://registry.npmjs.org/') }}:

- template: /eng/common/pipelines/templates/steps/reset-npmrc.yml
parameters:
Registry: ${{ parameters.Registry }}

- task: EsrpRelease@9
displayName: 'Publish ${{ parameters.ArtifactName }} via ESRP'
Expand Down Expand Up @@ -117,12 +119,6 @@ jobs:
condition: and(succeeded(), ne(variables['SkipPublishing'], 'true'))

- ${{ else }}:
- template: /eng/common/pipelines/templates/steps/create-authenticated-npmrc.yml
parameters:
npmrcPath: $(ArtifactPath)/.npmrc
registryUrl: ${{ parameters.Registry }}
CustomCondition: and(succeeded(), ne(variables['SkipPublishing'], 'true'))

- pwsh: |
foreach ($package in (dir $(ArtifactPath) *.tgz -Recurse)) {
Write-Host "npm publish $package --verbose --access public --tag $(TagName) --registry ${{ parameters.Registry }}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ parameters:
- name: ServiceConnection
type: string
default: ''
- name: SkipAuthentication
type: boolean
default: false

steps:
- pwsh: |
Expand All @@ -25,9 +28,10 @@ steps:
displayName: 'Create .npmrc'
condition: ${{ parameters.CustomCondition }}

- task: npmAuthenticate@0
displayName: Authenticate .npmrc
condition: ${{ parameters.CustomCondition }}
inputs:
workingFile: ${{ parameters.npmrcPath }}
azureDevOpsServiceConnection: ${{ parameters.ServiceConnection }}
- ${{ if not(parameters.SkipAuthentication) }}:
- task: npmAuthenticate@0
displayName: Authenticate .npmrc
condition: ${{ parameters.CustomCondition }}
inputs:
workingFile: ${{ parameters.npmrcPath }}
azureDevOpsServiceConnection: ${{ parameters.ServiceConnection }}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ parameters:
RepoId: $(Build.Repository.Name)
WorkingDirectory: ''
ScriptDirectory: eng/common/scripts
NpmConfigUserConfig: ''

steps:
- task: PowerShell@2
Expand All @@ -23,3 +24,5 @@ steps:
timeoutInMinutes: 5
env:
GH_TOKEN: $(azuresdk-github-pat)
${{ if ne(parameters.NpmConfigUserConfig, '') }}:
NPM_CONFIG_USERCONFIG: ${{ parameters.NpmConfigUserConfig }}
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ parameters:
- name: PackageSourceOverride
type: string
default: ''
- name: NpmConfigUserConfig
type: string
default: ''
steps:
- ${{ if eq(length(parameters.PackageInfoLocations), 0) }}:
- pwsh: |
Expand Down Expand Up @@ -91,6 +94,9 @@ steps:
-RepoId '${{ parameters.RepoId }}' `
-PackageSourceOverride '${{ parameters.PackageSourceOverride }}'
displayName: Apply Documentation Updates
env:
${{ if ne(parameters.NpmConfigUserConfig, '') }}:
NPM_CONFIG_USERCONFIG: ${{ parameters.NpmConfigUserConfig }}

- template: /eng/common/pipelines/templates/steps/git-push-changes.yml
parameters:
Expand Down
Loading