Skip to content

Commit

Permalink
fix: lerna publish script (#13254)
Browse files Browse the repository at this point in the history
* fix: lerna publish script

* fix: comment

* fix: bash returns 1 if no matches
  • Loading branch information
sobolk authored Sep 21, 2023
1 parent 0d5077a commit d2eb338
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
11 changes: 9 additions & 2 deletions .circleci/cb-publish-step-2-verdaccio.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,15 @@ function lernaPublishExitOnFailure {
set -e
# run lerna publish with the args that were passed to this function
# duplicate stdout to a temp file
# grep the temp file for the lerna err token and return exit 1 if found (-v option inverts grep exit code)
npx lerna publish "$@" | tee /tmp/publish-results && grep -qvz "lerna ERR!" < /tmp/publish-results
npx lerna publish "$@" | tee /tmp/publish-results
# grep the temp file for the lerna err token and return exit 1
number_of_lerna_errors=$(grep "lerna ERR" /tmp/publish-results | wc -l)
if [[ number_of_lerna_errors -gt 0 ]]; then
echo "Fail! Lerna error."
exit 1;
else
echo "Success! Lerna publish succeeded."
fi
}

npmRegistryUrl=$(npm get registry)
Expand Down
11 changes: 9 additions & 2 deletions .circleci/cb-publish-step-3-npm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,15 @@ function lernaPublishExitOnFailure {
set -e
# run lerna publish with the args that were passed to this function
# duplicate stdout to a temp file
# grep the temp file for the lerna err token and return exit 1 if found (-v option inverts grep exit code)
npx lerna publish "$@" | tee /tmp/publish-results && grep -qvz "lerna ERR!" < /tmp/publish-results
npx lerna publish "$@" | tee /tmp/publish-results
# grep the temp file for the lerna err token and return exit 1
number_of_lerna_errors=$(grep "lerna ERR" /tmp/publish-results | wc -l)
if [[ number_of_lerna_errors -gt 0 ]]; then
echo "Fail! Lerna error."
exit 1;
else
echo "Success! Lerna publish succeeded."
fi
}

# verifies that binaries are uploaded and available before publishing to NPM
Expand Down

0 comments on commit d2eb338

Please sign in to comment.