File tree Expand file tree Collapse file tree
eng/common/pipelines/templates/steps Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ parameters :
2+ - name : npmrcPath
3+ type : string
4+ - name : registryUrl
5+ type : string
6+ default : " https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-js/npm/registry/"
7+ - name : CustomCondition
8+ type : string
9+ default : succeeded()
10+ - name : ServiceConnection
11+ type : string
12+ default : " "
13+
14+ steps :
15+ - pwsh : |
16+ Write-Host "Creating .npmrc file ${{ parameters.npmrcPath }} for registry ${{ parameters.registryUrl }}"
17+ $parentFolder = Split-Path -Path '${{ parameters.npmrcPath }}' -Parent
18+
19+ if (!(Test-Path $parentFolder)) {
20+ Write-Host "Creating folder $parentFolder"
21+ New-Item -Path $parentFolder -ItemType Directory | Out-Null
22+ }
23+
24+ $content = "registry=${{ parameters.registryUrl }}"
25+ $content | Out-File '${{ parameters.npmrcPath }}'
26+ displayName: "Create .npmrc"
27+ condition: ${{ parameters.CustomCondition }}
28+
29+ - task : npmAuthenticate@0
30+ displayName : Authenticate .npmrc
31+ condition : ${{ parameters.CustomCondition }}
32+ inputs :
33+ workingFile : ${{ parameters.npmrcPath }}
34+ azureDevOpsServiceConnection : ${{ parameters.ServiceConnection }}
You can’t perform that action at this time.
0 commit comments