Skip to content

Commit 3057d6e

Browse files
Use both NPM_CONFIG_USERCONFIG and NPM_CONFIG_REGISTRY to give the pipeline more flexibility (#45648)
Co-authored-by: Chidozie Ononiwu <chononiw@microsoft.com>
1 parent 1e540de commit 3057d6e

3 files changed

Lines changed: 15 additions & 6 deletions

File tree

eng/common/pipelines/templates/jobs/npm-publish.yml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,6 @@ jobs:
6767
Write-Host "##vso[task.setvariable variable=TagName]$tag"
6868
Write-Host "Publishing packages with tag: $tag"
6969
displayName: 'Packages to be published'
70-
71-
- template: /eng/common/pipelines/templates/steps/create-authenticated-npmrc.yml
72-
parameters:
73-
npmrcPath: $(ArtifactPath)/.npmrc
74-
registryUrl: ${{ parameters.Registry }}
75-
CustomCondition: and(succeeded(), ne(variables['SkipPublishing'], 'true'))
7670
7771
- ${{ if eq(parameters.Registry, 'https://registry.npmjs.org/') }}:
7872

@@ -119,6 +113,13 @@ jobs:
119113
condition: and(succeeded(), ne(variables['SkipPublishing'], 'true'))
120114
121115
- ${{ else }}:
116+
117+
- template: /eng/common/pipelines/templates/steps/create-authenticated-npmrc.yml
118+
parameters:
119+
npmrcPath: $(ArtifactPath)/.npmrc
120+
registryUrl: ${{ parameters.Registry }}
121+
CustomCondition: and(succeeded(), ne(variables['SkipPublishing'], 'true'))
122+
122123
- pwsh: |
123124
foreach ($package in (dir $(ArtifactPath) *.tgz -Recurse)) {
124125
Write-Host "npm publish $package --verbose --access public --tag $(TagName) --registry ${{ parameters.Registry }}"

eng/common/pipelines/templates/steps/create-tags-and-git-release.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ parameters:
77
WorkingDirectory: ''
88
ScriptDirectory: eng/common/scripts
99
NpmConfigUserConfig: ''
10+
NpmConfigRegistry: ''
1011

1112
steps:
1213
- task: PowerShell@2
@@ -26,3 +27,5 @@ steps:
2627
GH_TOKEN: $(azuresdk-github-pat)
2728
${{ if ne(parameters.NpmConfigUserConfig, '') }}:
2829
NPM_CONFIG_USERCONFIG: ${{ parameters.NpmConfigUserConfig }}
30+
${{ if ne(parameters.NpmConfigRegistry, '') }}:
31+
NPM_CONFIG_REGISTRY: ${{ parameters.NpmConfigRegistry }}

eng/common/pipelines/templates/steps/update-docsms-metadata.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ parameters:
3232
- name: NpmConfigUserConfig
3333
type: string
3434
default: ''
35+
- name: NpmConfigRegistry
36+
type: string
37+
default: ''
3538
steps:
3639
- ${{ if eq(length(parameters.PackageInfoLocations), 0) }}:
3740
- pwsh: |
@@ -97,6 +100,8 @@ steps:
97100
env:
98101
${{ if ne(parameters.NpmConfigUserConfig, '') }}:
99102
NPM_CONFIG_USERCONFIG: ${{ parameters.NpmConfigUserConfig }}
103+
${{ if ne(parameters.NpmConfigRegistry, '') }}:
104+
NPM_CONFIG_REGISTRY: ${{ parameters.NpmConfigRegistry }}
100105
101106
- template: /eng/common/pipelines/templates/steps/git-push-changes.yml
102107
parameters:

0 commit comments

Comments
 (0)