Skip to content

Commit 87f7adc

Browse files
committed
ci: set npmAuthToken in yarnrc, not npmrc
1 parent 556629e commit 87f7adc

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

.ado/jobs/npm-publish.yml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ jobs:
5050
# Disable Nightly publishing on the main branch
5151
- ${{ if endsWith(variables['Build.SourceBranchName'], '-stable') }}:
5252
- script: |
53-
echo "//registry.npmjs.org/:_authToken=$(npmAuthToken)" > ~/.npmrc
53+
yarn config set npmPublishRegistry "https://registry.npmjs.org"
54+
yarn config set npmAuthToken $(npmAuthToken)
5455
node .ado/scripts/prepublish-check.mjs --verbose --tag $(publishTag)
5556
displayName: Set and validate npm auth
5657
condition: and(succeeded(), eq(variables['publish_react_native_macos'], '1'))
@@ -76,6 +77,13 @@ jobs:
7677
condition: and(succeeded(), eq(variables['publish_react_native_macos'], '1'))
7778
7879
- script: |
79-
rm -f ~/.npmrc
80-
displayName: Remove npmrc if it exists
80+
# Check and unset npmAuthToken if it exists
81+
if [ "$(yarn config npmAuthToken --json | jq -r '.effective')" != "null" ]; then
82+
yarn config unset npmAuthToken
83+
fi
84+
# Check and unset npmPublishRegistry if it exists
85+
if [ "$(yarn config npmPublishRegistry --json | jq -r '.effective')" != "null" ]; then
86+
yarn config unset npmPublishRegistry
87+
fi
88+
displayName: Unset npm configuration
8189
condition: always()

0 commit comments

Comments
 (0)