Skip to content

Commit

Permalink
fix: remove set -e
Browse files Browse the repository at this point in the history
  • Loading branch information
levy committed Jul 30, 2020
1 parent d87ca9b commit 5492384
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
8 changes: 6 additions & 2 deletions notify.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#!/bin/sh
set -e

echo "checking TRAVIS_TEST_RESULT"
if [ "$TRAVIS_TEST_RESULT" != "0" ]
then
Expand All @@ -18,6 +16,12 @@ git push github HEAD:master --follow-tags
echo "generating github release notes"
GREN_GITHUB_TOKEN=$GITHUB_TOKEN yarn release

if [ $? -ne 0 ]
then
echo "gren fails, bye"
exit 1
fi

echo "downloading github release info"
url=https://api.github.com/repos/$TRAVIS_REPO_SLUG/releases/latest
resp_tmp_file=resp.tmp
Expand Down
10 changes: 8 additions & 2 deletions templates/notify.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#!/bin/sh
# https://stackoverflow.com/questions/13872048/bash-script-what-does-bin-bash-mean
set -e

echo "1/5: checking TRAVIS_TEST_RESULT"
if [ "$TRAVIS_TEST_RESULT" != "0" ]
then
Expand All @@ -13,12 +11,20 @@ ORG_NAME=$(echo "$TRAVIS_REPO_SLUG" | cut -d '/' -f 1)
REPO_NAME=$(echo "$TRAVIS_REPO_SLUG" | cut -d '/' -f 2)

echo "2/5: pushing commit and tag to github"
# 该命令很可能报错,但不影响实际进行,因而不能简单地在脚本开头 set -e
git remote add github https://$GITHUB_TOKEN@github.com/$TRAVIS_REPO_SLUG.git > /dev/null 2>&1
git push github HEAD:master --follow-tags

echo "3/5: generating github release notes"
GREN_GITHUB_TOKEN=$GITHUB_TOKEN yarn release

# 避免发送错误信息
if [ $? -ne 0 ]
then
echo "gren fails, bye"
exit 1
fi

echo "4/5: downloading github release info"
url=https://api.github.com/repos/$TRAVIS_REPO_SLUG/releases/latest
resp_tmp_file=resp.tmp
Expand Down

0 comments on commit 5492384

Please sign in to comment.