Skip to content

Commit

Permalink
address shellcheck nits
Browse files Browse the repository at this point in the history
  • Loading branch information
rickycodes committed Jun 24, 2024
1 parent 70d4ceb commit c1f5049
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions scripts/publish.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,9 @@ 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
echo "//registry.npmjs.org/:_authToken=${YARN_NPM_AUTH_TOKEN}" >> $HOME/.npmrc
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 All @@ -25,7 +24,7 @@ else
fi

# "dry-run" for polyrepo
if [[ -z $YARN_NPM_AUTH_TOKEN && ! -n "$1" ]]; then
if [[ -z "$YARN_NPM_AUTH_TOKEN" && -z "$1" ]]; then
echo "Notice: 'npm-token' not set. Running '$PACK_CMD'."
$INSTALL_CMD
$PACK_CMD
Expand Down Expand Up @@ -53,7 +52,7 @@ if [[ -n "$1" ]]; then
LATEST_PACKAGE_VERSION=$(npm view "$PACKAGE_NAME" dist-tags --workspaces false --json | jq --raw-output --arg tag "$PUBLISH_NPM_TAG" '.[$tag]' || echo "")

# "dry-run" for monorepo
if [ -z $YARN_NPM_AUTH_TOKEN && ! "$LATEST_PACKAGE_VERSION" = "$CURRENT_PACKAGE_VERSION" ]; then
if [[ -z "$YARN_NPM_AUTH_TOKEN" && ! "$LATEST_PACKAGE_VERSION" = "$CURRENT_PACKAGE_VERSION" ]]; then
echo "Notice: 'npm-token' not set. Running '$PACK_CMD'."
$PACK_CMD
exit 0
Expand All @@ -67,4 +66,4 @@ fi

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

0 comments on commit c1f5049

Please sign in to comment.