Skip to content

Commit 7764e84

Browse files
author
Travis CI
committed
increasing errors logging
1 parent 124639d commit 7764e84

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

github-cli.sh

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ create_release(){
2323
tee -a /dev/stderr | jq -r '.id') 2> /tmp/stderr 1> /tmp/stdout
2424

2525
if test "$(cat /tmp/stderr | head -n 1)" -ne "201"; then
26-
echo -e "> Can't create release: \n $(cat /tmp/stderr)"
27-
exit 1
26+
echo -e "> Can't create release: \n $(cat /tmp/stderr)" >&2
27+
exit 3
2828
fi
2929
local RELEASE_ID=$(cat /tmp/stdout)
3030
echo "> Release created with id $RELEASE_ID" >&2
@@ -38,7 +38,7 @@ upload_file(){
3838
)
3939

4040
if test "$(echo "$OUT" | tail -n 1)" -ne "201"; then
41-
echo -e "> Can't upload file: $TARGET_FILE \n $(echo ${OUT})"
41+
echo -e "> Can't upload file: $TARGET_FILE \n $(echo ${OUT})" >&2
4242
exit 2
4343
fi
4444
}
@@ -47,15 +47,18 @@ upload_files(){
4747
for SOURCE_FILE in "$@"; do
4848
if [ -f "$SOURCE_FILE" ]; then
4949
TARGET_FILE="$(basename $SOURCE_FILE)"
50-
echo "> uploading $TARGET_FILE"
50+
echo "> uploading $TARGET_FILE" >&2
5151
md5sum $SOURCE_FILE && ls -lha $SOURCE_FILE
5252
upload_file
5353
fi
5454
done
5555
}
5656

5757
validate_repo_token(){
58-
if [ "$REPO_TOKEN" = "" ] ; then echo "REPO_TOKEN cannot be empty"; exit 1; fi
58+
if [ "$REPO_TOKEN" = "" ] ; then
59+
echo "REPO_TOKEN cannot be empty" >&2
60+
exit 4;
61+
fi
5962
}
6063

6164
create_tag(){
@@ -68,7 +71,7 @@ create_tag(){
6871
REMOTE="https://${REPO_TOKEN}@github.com/${USERNAME}/${REPOSITORY}.git"
6972
git push "$REMOTE" "$CURRENT_BRANCH" --tags
7073
git status
71-
echo "> Pushed"
74+
echo "> Pushed" >&2
7275
}
7376

7477
USERNAME="$2"
@@ -77,7 +80,7 @@ APP_VERSION="$4"
7780
CURRENT_BRANCH="$5"
7881
DESC="$6"
7982

80-
echo "> USERNAME=${USERNAME}, REPOSITORY=${REPOSITORY}, APP_VERSION=${APP_VERSION}, CURRENT_BRANCH=${CURRENT_BRANCH}, DESC=${DESC}"
83+
echo "> USERNAME=${USERNAME}, REPOSITORY=${REPOSITORY}, APP_VERSION=${APP_VERSION}, CURRENT_BRANCH=${CURRENT_BRANCH}, DESC=${DESC}" >&2
8184

8285
case $1 in
8386

0 commit comments

Comments
 (0)