Skip to content

Commit 462d017

Browse files
committed
add .npmrc file if one doesn't exist
1 parent 6dad4fa commit 462d017

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

build/templates/publish-extension.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -165,9 +165,6 @@ jobs:
165165
type: releaseJob # This makes a job a release job
166166
isProduction: true # Indicates a production release
167167
steps:
168-
- checkout: self
169-
fetchDepth: 1
170-
fetchTags: false
171168

172169
- template: setup.yml
173170
parameters:

build/templates/setup.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,20 @@ parameters:
99

1010
steps:
1111
- ${{ if eq(parameters.installNode, true) }}:
12+
- pwsh: |
13+
if (-not (Test-Path '.npmrc')) {
14+
Write-Host 'No .npmrc found, creating one with public npm registry'
15+
@"
16+
# Force public npm registry to avoid CI auth (E401) when no token is provided
17+
registry=https://registry.npmjs.org/
18+
# Do not require auth for public installs
19+
always-auth=false
20+
"@ | Out-File -FilePath '.npmrc' -Encoding utf8
21+
} else {
22+
Write-Host '.npmrc already exists'
23+
}
24+
displayName: Ensure .npmrc exists
25+
1226
- task: npmAuthenticate@0
1327
inputs:
1428
workingFile: .npmrc

0 commit comments

Comments
 (0)