Skip to content

Commit b33c2e0

Browse files
Add eng/common directory
1 parent 5dbd815 commit b33c2e0

1 file changed

Lines changed: 34 additions & 0 deletions

File tree

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
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 }}

0 commit comments

Comments
 (0)