Skip to content

Commit

Permalink
fix: npm login before npm publish
Browse files Browse the repository at this point in the history
  • Loading branch information
legobeat committed Jun 12, 2024
1 parent 7595610 commit da83439
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion scripts/publish.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@ if [[ "$YARN_MAJOR" -ge "3" ]]; then
PACK_CMD="yarn pack --out /tmp/%s-%v.tgz"
# install is handled by yarn berry pack/publish
INSTALL_CMD=""
LOGIN_CMD=""
else
echo "Warning: Did not detect compatible yarn version. This action officially supports Yarn v3 and newer. Falling back to using npm." >&2
export npm_config__auth="$YARN_NPM_AUTH_TOKEN"
echo "//registry.npmjs.org/:_authToken=${YARN_NPM_AUTH_TOKEN}" >> $HOME/.npmrc
PUBLISH_CMD="npm publish --tag $PUBLISH_NPM_TAG"
PACK_CMD="npm pack --pack-destination=/tmp/"
if [[ -f 'yarn.lock' ]]; then
Expand Down Expand Up @@ -58,3 +59,4 @@ fi

$INSTALL_CMD
$PUBLISH_CMD
rm -f $HOME/.npmrc

0 comments on commit da83439

Please sign in to comment.