Skip to content

Commit

Permalink
use npm config to set NPM auth token in github actions
Browse files Browse the repository at this point in the history
The previous PR committed the .npmrc which means we now get publish errors that
it has uncommitted changes once the auth token is added in the CI. This
commit uses `npm config set //<registry>:...` to add the token to the
user config in order to keep the repository config clean.
  • Loading branch information
deej-io committed Aug 5, 2024
1 parent eff4f77 commit 19976ee
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ jobs:
git config --global user.name "lerna-ci-mml"
# Set up npm auth token from secret for publishing
echo //registry.npmjs.org/:_authToken=${NPM_TOKEN} > .npmrc
npm config set //registry.npmjs.org/:_authToken=${NPM_TOKEN}
# Publish the current commit as an "experimental" version
version="0.0.0-experimental-$(git rev-parse --short HEAD)-$(date +'%Y%m%d')"
Expand Down Expand Up @@ -140,7 +140,7 @@ jobs:
git config --global user.name "lerna-ci-mml"
# Set up npm auth token from secret for publishing
echo //registry.npmjs.org/:_authToken=${NPM_TOKEN} > .npmrc
npm config set //registry.npmjs.org/:_authToken=${NPM_TOKEN}
# Attempt to publish at the current version - this will skip if the version already exists
echo "Attempting to publishing latest version"
Expand Down

0 comments on commit 19976ee

Please sign in to comment.