Skip to content

Commit 79b1658

Browse files
author
Travis CI
committed
fixing chars escape
1 parent 7764e84 commit 79b1658

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

github-cli.sh

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,24 @@ create_release(){
88
local APP_VERSION="$3"
99
local CURRENT_BRANCH="$4"
1010
local DESC="$5"
11-
local PAYLOAD='{
12-
"tag_name": "%s",
13-
"target_commitish": "%s",
14-
"name": "%s",
15-
"body": "%s",
11+
local PAYLOAD=$(echo '{}' | jq --arg tag_name "$APP_VERSION" \
12+
--arg target_commitish "$CURRENT_BRANCH" \
13+
--arg body "$DESC" '{
14+
$tag_name,
15+
$target_commitish,
16+
$tag_name,
17+
$body,
1618
"draft": false,
1719
"prerelease": true
18-
}'
19-
local PAYLOAD=$(printf "$PAYLOAD" $APP_VERSION $CURRENT_BRANCH $APP_VERSION "$DESC")
20+
}')
2021
(curl -s -X POST -w '%{stderr}%{http_code}\n%{stdout}\n' \
2122
"https://api.github.com/repos/${USERNAME}/${REPOSITORY}/releases?access_token=$REPO_TOKEN" \
2223
--data "$PAYLOAD" |\
2324
tee -a /dev/stderr | jq -r '.id') 2> /tmp/stderr 1> /tmp/stdout
2425

2526
if test "$(cat /tmp/stderr | head -n 1)" -ne "201"; then
26-
echo -e "> Can't create release: \n $(cat /tmp/stderr)" >&2
27-
exit 3
27+
echo -e "> Can't create release: \nreq=${PAYLOAD}\n\nres=$(cat /tmp/stderr)" >&2
28+
exit 10
2829
fi
2930
local RELEASE_ID=$(cat /tmp/stdout)
3031
echo "> Release created with id $RELEASE_ID" >&2
@@ -39,7 +40,7 @@ upload_file(){
3940

4041
if test "$(echo "$OUT" | tail -n 1)" -ne "201"; then
4142
echo -e "> Can't upload file: $TARGET_FILE \n $(echo ${OUT})" >&2
42-
exit 2
43+
exit 11
4344
fi
4445
}
4546

@@ -57,7 +58,7 @@ upload_files(){
5758
validate_repo_token(){
5859
if [ "$REPO_TOKEN" = "" ] ; then
5960
echo "REPO_TOKEN cannot be empty" >&2
60-
exit 4;
61+
exit 12;
6162
fi
6263
}
6364

0 commit comments

Comments
 (0)