Skip to content

Commit f34d82f

Browse files
committed
this should work
1 parent b47ad11 commit f34d82f

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

ci/steps/publish-npm.sh

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ main() {
7373
NPM_ENVIRONMENT="development"
7474
fi
7575

76-
echo "Using npm environment: $NPM_ENVIRONMENT"
76+
echo "- npm environment: $NPM_ENVIRONMENT"
7777
fi
7878

7979
# NOTE@jsjoeio - this script assumes we have the artifact downloaded on disk
@@ -97,7 +97,6 @@ main() {
9797
else
9898
COMMIT_SHA="$GITHUB_SHA"
9999
echo "Not a production environment"
100-
echo "Found environment: $NPM_ENVIRONMENT"
101100
echo "Manually bumping npm version..."
102101

103102
if [[ "$NPM_ENVIRONMENT" == "staging" ]]; then
@@ -117,8 +116,8 @@ main() {
117116
NPM_TAG="$PR_NUMBER"
118117
fi
119118

120-
echo "using tag: $NPM_TAG"
121-
echo "using package name: $PACKAGE_NAME"
119+
echo "- tag: $NPM_TAG"
120+
echo "- package name: $PACKAGE_NAME"
122121

123122
# We modify the version in the package.json
124123
# to be the current version + the PR number + commit SHA
@@ -141,10 +140,16 @@ main() {
141140
fi
142141

143142
# We need to make sure we haven't already published the version.
144-
# This is because npm view won't exit with non-zero so we have
145-
# to check the output.
143+
# check if version is published already.
144+
# if we get error, continue with script because we want to publish
145+
# if version is valid, we check if we're publishing the same one
146+
146147
local hasVersion
147-
hasVersion=$(npm view "$PACKAGE_NAME@$NPM_VERSION" version)
148+
if ! hasVersion=$(npm view "$PACKAGE_NAME@$NPM_VERSION" version) ; then
149+
echo "$NPM_VERSION was not found $PACKAGE_NAME"
150+
echo "continuing with publish script"
151+
fi
152+
148153
if [[ $hasVersion == "$NPM_VERSION" ]]; then
149154
echo "$NPM_VERSION is already published under $PACKAGE_NAME"
150155
return

0 commit comments

Comments
 (0)