Skip to content

Commit 2e39616

Browse files
authored
ci: set npmAuthToken in yarnrc, not npmrc (#2603)
## Summary: With #2560 and followup changes, we call `yarn npm publish` directly instead of `nx release publish` (Which indirectly used npm publish). Yarn's NPM publish command grabs its auth token from `.yarnrc.yml`, not `.npmrc`. Let's update our CI steps that set this. ## Test Plan: Tested that I can call `yarn config set / unset` to set and unset these values.
1 parent b4fec97 commit 2e39616

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

.ado/jobs/npm-publish.yml

Lines changed: 5 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,7 @@ 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+
yarn config unset npmAuthToken
81+
yarn config unset npmPublishRegistry
82+
displayName: Unset npm configuration
8183
condition: always()

0 commit comments

Comments
 (0)