Skip to content

Commit 555a19c

Browse files
Saadnajmitido64
andauthored
ci: setup npm authentication for publish (#2422)
## Summary: `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. ## Test Plan: 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 <[email protected]>
1 parent 88b4831 commit 555a19c

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

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

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,24 @@ steps:
2626
2727
- script: |
2828
git switch $(Build.SourceBranchName)
29+
echo "//registry.npmjs.org/:_authToken=$(NODE_AUTH_TOKEN)" > ~/.npmrc
2930
yarn nx release --skip-publish --verbose
30-
yarn nx release publish --excludeTaskDependencies
3131
env:
3232
GITHUB_TOKEN: $(githubAuthToken)
33+
displayName: Version Packages and Github Release
34+
condition: and(succeeded(), eq(variables['publish_react_native_macos'], '1'))
35+
36+
- script: |
37+
echo "//registry.npmjs.org/:_authToken=$(NODE_AUTH_TOKEN)" > ~/.npmrc
38+
yarn nx release publish --excludeTaskDependencies
39+
env:
3340
NODE_AUTH_TOKEN: $(npmAuthToken)
34-
displayName: Version and publish packages
41+
displayName: Publish packages
3542
condition: and(succeeded(), eq(variables['publish_react_native_macos'], '1'))
43+
44+
- script: |
45+
rm -f ~/.npmrc
46+
env:
47+
NODE_AUTH_TOKEN: $(npmAuthToken)
48+
displayName: Remove npmrc if it exists
49+
condition: always()

0 commit comments

Comments
 (0)