Skip to content

Commit 74cade1

Browse files
Saadnajmitido64
andcommitted
ci: setup npm authentication for publish (microsoft#2422)
`nx release` requires a `.npmrc` file. Let's create one with our NPM auth token, and remove it after we finish publishing out of an abundance of caution. Change is already in 0.76-stable and 0.77-stable. For whatever reason, it works on 0.76 and not on 0.77 --------- Co-authored-by: Tommy Nguyen <4123478+tido64@users.noreply.github.com>
1 parent 701cc3d commit 74cade1

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

.ado/templates/npm-publish-steps.yml

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,22 @@ steps:
2323
git switch $(Build.SourceBranchName)
2424
echo "//registry.npmjs.org/:_authToken=$(NODE_AUTH_TOKEN)" > ~/.npmrc
2525
yarn nx release --skip-publish --verbose
26-
yarn nx release publish --excludeTaskDependencies
27-
rm ~/.npmrc
2826
env:
2927
GITHUB_TOKEN: $(githubAuthToken)
28+
displayName: Version Packages and Github Release
29+
condition: and(succeeded(), eq(variables['publish_react_native_macos'], '1'))
30+
31+
- script: |
32+
echo "//registry.npmjs.org/:_authToken=$(NODE_AUTH_TOKEN)" > ~/.npmrc
33+
yarn nx release publish --excludeTaskDependencies
34+
env:
3035
NODE_AUTH_TOKEN: $(npmAuthToken)
31-
displayName: Version and publish packages
36+
displayName: Publish packages
3237
condition: and(succeeded(), eq(variables['publish_react_native_macos'], '1'))
38+
39+
- script: |
40+
rm -f ~/.npmrc
41+
env:
42+
NODE_AUTH_TOKEN: $(npmAuthToken)
43+
displayName: Remove npmrc if it exists
44+
condition: always()

0 commit comments

Comments
 (0)