@@ -73,7 +73,7 @@ main() {
73
73
NPM_ENVIRONMENT=" development"
74
74
fi
75
75
76
- echo " Using npm environment: $NPM_ENVIRONMENT "
76
+ echo " - npm environment: $NPM_ENVIRONMENT "
77
77
fi
78
78
79
79
# NOTE@jsjoeio - this script assumes we have the artifact downloaded on disk
@@ -97,7 +97,6 @@ main() {
97
97
else
98
98
COMMIT_SHA=" $GITHUB_SHA "
99
99
echo " Not a production environment"
100
- echo " Found environment: $NPM_ENVIRONMENT "
101
100
echo " Manually bumping npm version..."
102
101
103
102
if [[ " $NPM_ENVIRONMENT " == " staging" ]]; then
@@ -117,8 +116,8 @@ main() {
117
116
NPM_TAG=" $PR_NUMBER "
118
117
fi
119
118
120
- echo " using tag: $NPM_TAG "
121
- echo " using package name: $PACKAGE_NAME "
119
+ echo " - tag: $NPM_TAG "
120
+ echo " - package name: $PACKAGE_NAME "
122
121
123
122
# We modify the version in the package.json
124
123
# to be the current version + the PR number + commit SHA
@@ -141,10 +140,16 @@ main() {
141
140
fi
142
141
143
142
# 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
+
146
147
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
+
148
153
if [[ $hasVersion == " $NPM_VERSION " ]]; then
149
154
echo " $NPM_VERSION is already published under $PACKAGE_NAME "
150
155
return
0 commit comments