Skip to content

Commit c729d18

Browse files
committed
Pass the NPM auth token to rush publish via environment variable.
1 parent 50d6655 commit c729d18

2 files changed

Lines changed: 16 additions & 1 deletion

File tree

common/config/azure-pipelines/templates/buildAndPublish.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,7 @@ steps:
44
- template: ./build.yaml
55
- script: 'node common/scripts/install-run-rush.js version --bump --version-policy $(VersionPolicy) --target-branch $(Build.SourceBranchName)'
66
displayName: 'Rush Version'
7-
- script: 'node common/scripts/install-run-rush.js publish --apply --publish --include-all --target-branch $(Build.SourceBranchName) --npm-auth-token $(npmToken) --add-commit-details --set-access-level public'
7+
- script: 'node common/scripts/install-run-rush.js publish --apply --publish --include-all --target-branch $(Build.SourceBranchName) --add-commit-details --set-access-level public'
88
displayName: 'Rush Publish'
9+
env:
10+
NPM_AUTH_TOKEN: $(npmToken)

common/config/rush/.npmrc-publish

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Rush uses this file to configure the package registry, regardless of whether the
2+
# package manager is PNPM, NPM, or Yarn. Prior to invoking the package manager,
3+
# Rush will always copy this file to the folder where installation is performed.
4+
# When NPM is the package manager, Rush works around NPM's processing of
5+
# undefined environment variables by deleting any lines that reference undefined
6+
# environment variables.
7+
#
8+
# DO NOT SPECIFY AUTHENTICATION CREDENTIALS IN THIS FILE. It should only be used
9+
# to configure registry sources.
10+
11+
registry=https://registry.npmjs.org/
12+
always-auth=true
13+
//registry.npmjs.org/:_authToken=${NPM_AUTH_TOKEN}

0 commit comments

Comments
 (0)