diff --git a/script/notify b/script/notify index 781659c2..7c7827a2 100755 --- a/script/notify +++ b/script/notify @@ -1,7 +1,10 @@ #!/bin/bash set -e -if [[ $# -lt 1 ]]; then +if [[ "$CI" != "true" ]]; then + echo "(notify bailing: not in CI)" + exit +elif [[ $# -lt 1 ]]; then echo "No status provided!" >&2 exit 1 fi diff --git a/script/release b/script/release index e585d610..557aac99 100755 --- a/script/release +++ b/script/release @@ -2,5 +2,7 @@ set -e echo "📦 Publishing latest release..." script/notify pending -lerna exec -- npm publish +# note: try-publish should exit cleanly if it detects a duplicate +# published version +lerna exec -- $(pwd)/script/try-publish script/notify success diff --git a/script/release-candidate b/script/release-candidate index 438ddb09..85f4608b 100755 --- a/script/release-candidate +++ b/script/release-candidate @@ -60,5 +60,6 @@ done # publish all the things! script/notify pending -lerna exec --bail=false -- npm publish --tag=$npm_tag +# note: this should NOT fail, so --bail=true applies +lerna exec -- npm publish --tag=$npm_tag script/notify success diff --git a/script/try-publish b/script/try-publish new file mode 100755 index 00000000..746916af --- /dev/null +++ b/script/try-publish @@ -0,0 +1,12 @@ +#!/bin/bash +set -e +# pwd +package=$(jq .name package.json) +version=$(jq .version package.json) +published=$(npm info "$package@$version") +if [[ "$version" = "$published" ]]; then + echo "⚠️ $package@$version is already published!" +else + echo "📦 npm publish: $package@$version" + npm publish $@ +fi