From 9a8249da119d4d162c124b9362a671fb56a7b2fe Mon Sep 17 00:00:00 2001 From: legobt <6wbvkn0j@anonaddy.me> Date: Sat, 1 Jun 2024 00:52:05 +0000 Subject: [PATCH] fix: npm login before npm publish --- scripts/publish.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/publish.sh b/scripts/publish.sh index b233ade..9192cc6 100755 --- a/scripts/publish.sh +++ b/scripts/publish.sh @@ -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 @@ -51,3 +52,4 @@ fi $INSTALL_CMD $PUBLISH_CMD +rm -f $HOME/.npmrc