Skip to content
Merged
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.

In npm-publish.yml the .npmrc is now created under $(ArtifactPath) for all registries, but the subsequent Verify tag after ESRP release step (npmjs.org branch) runs npm view ... without workingDirectory: $(ArtifactPath) (and without setting NPM_CONFIG_USERCONFIG). With the removal of the prior registry reset step, npm view may use the agent/global npm config instead of the intended registry, causing tag verification to query the wrong feed. Consider either setting workingDirectory: $(ArtifactPath) (or env: NPM_CONFIG_USERCONFIG=$(ArtifactPath)/.npmrc) on the verification step, or restoring an explicit registry override before running npm view.

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