File tree 1 file changed +12
-11
lines changed
1 file changed +12
-11
lines changed Original file line number Diff line number Diff line change @@ -8,23 +8,24 @@ create_release(){
8
8
local APP_VERSION=" $3 "
9
9
local CURRENT_BRANCH=" $4 "
10
10
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,
16
18
"draft": false,
17
19
"prerelease": true
18
- }'
19
- local PAYLOAD=$( printf " $PAYLOAD " $APP_VERSION $CURRENT_BRANCH $APP_VERSION " $DESC " )
20
+ }' )
20
21
(curl -s -X POST -w ' %{stderr}%{http_code}\n%{stdout}\n' \
21
22
" https://api.github.com/repos/${USERNAME} /${REPOSITORY} /releases?access_token=$REPO_TOKEN " \
22
23
--data " $PAYLOAD " | \
23
24
tee -a /dev/stderr | jq -r ' .id' ) 2> /tmp/stderr 1> /tmp/stdout
24
25
25
26
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
28
29
fi
29
30
local RELEASE_ID=$( cat /tmp/stdout)
30
31
echo " > Release created with id $RELEASE_ID " >&2
@@ -39,7 +40,7 @@ upload_file(){
39
40
40
41
if test " $( echo " $OUT " | tail -n 1) " -ne " 201" ; then
41
42
echo -e " > Can't upload file: $TARGET_FILE \n $( echo ${OUT} ) " >&2
42
- exit 2
43
+ exit 11
43
44
fi
44
45
}
45
46
@@ -57,7 +58,7 @@ upload_files(){
57
58
validate_repo_token (){
58
59
if [ " $REPO_TOKEN " = " " ] ; then
59
60
echo " REPO_TOKEN cannot be empty" >&2
60
- exit 4 ;
61
+ exit 12 ;
61
62
fi
62
63
}
63
64
You can’t perform that action at this time.
0 commit comments