Skip to content

Commit d2eb338

Browse files
authored
fix: lerna publish script (#13254)
* fix: lerna publish script * fix: comment * fix: bash returns 1 if no matches
1 parent 0d5077a commit d2eb338

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

.circleci/cb-publish-step-2-verdaccio.sh

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,15 @@ function lernaPublishExitOnFailure {
88
set -e
99
# run lerna publish with the args that were passed to this function
1010
# duplicate stdout to a temp file
11-
# grep the temp file for the lerna err token and return exit 1 if found (-v option inverts grep exit code)
12-
npx lerna publish "$@" | tee /tmp/publish-results && grep -qvz "lerna ERR!" < /tmp/publish-results
11+
npx lerna publish "$@" | tee /tmp/publish-results
12+
# grep the temp file for the lerna err token and return exit 1
13+
number_of_lerna_errors=$(grep "lerna ERR" /tmp/publish-results | wc -l)
14+
if [[ number_of_lerna_errors -gt 0 ]]; then
15+
echo "Fail! Lerna error."
16+
exit 1;
17+
else
18+
echo "Success! Lerna publish succeeded."
19+
fi
1320
}
1421

1522
npmRegistryUrl=$(npm get registry)

.circleci/cb-publish-step-3-npm.sh

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,15 @@ function lernaPublishExitOnFailure {
88
set -e
99
# run lerna publish with the args that were passed to this function
1010
# duplicate stdout to a temp file
11-
# grep the temp file for the lerna err token and return exit 1 if found (-v option inverts grep exit code)
12-
npx lerna publish "$@" | tee /tmp/publish-results && grep -qvz "lerna ERR!" < /tmp/publish-results
11+
npx lerna publish "$@" | tee /tmp/publish-results
12+
# grep the temp file for the lerna err token and return exit 1
13+
number_of_lerna_errors=$(grep "lerna ERR" /tmp/publish-results | wc -l)
14+
if [[ number_of_lerna_errors -gt 0 ]]; then
15+
echo "Fail! Lerna error."
16+
exit 1;
17+
else
18+
echo "Success! Lerna publish succeeded."
19+
fi
1320
}
1421

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

0 commit comments

Comments
 (0)