9
9
#
10
10
TOKEN=" $INPUT_TOKEN "
11
11
if [ -z " $TOKEN " ]; then
12
+ >&2 echo " ::error::missing: token (see log for details)"
12
13
>&2 printf " \nERR: Invalid input: 'token' is required, and must be specified.\n"
13
14
>&2 printf " \tNote: It's necessary to interact with Github's API.\n\n"
14
15
>&2 printf " Try:\n"
15
16
>&2 printf " \tuses: %s\n" " $PKG "
16
17
>&2 printf " \twith:\n"
17
18
>&2 printf " \t token: \$ {{ secrets.GITHUB_TOKEN }}\n"
18
- >&2 printf " \t ...\n"
19
- >&2 echo " ::error::missing: token (see log for details)"
19
+ >&2 printf " \t ...\n\n"
20
20
exit 1
21
21
fi
22
22
30
30
31
31
# If all ways of getting the $tag failed, exit with an error
32
32
if [ -z " $tag " ]; then
33
+ >&2 echo " ::error::missing: tag (see log for details)"
33
34
>&2 printf " \nERR: Invalid input: 'tag' is required, and must be specified.\n"
34
35
>&2 printf " Try:\n"
35
36
>&2 printf " \tuses: %s\n" " $PKG "
@@ -40,20 +41,19 @@ if [ -z "$tag" ]; then
40
41
>&2 printf ' \twith:\n'
41
42
>&2 printf " \t tag: \$ {{ env.TAG }}\n"
42
43
>&2 printf " \t ...\n\n"
43
- echo " ::error::missing: tag (see log for details)"
44
44
exit 1
45
45
fi
46
46
47
47
# Verify that gzip: option is set to any of the allowed values
48
48
if [ " $INPUT_GZIP " != " true" ] && [ " $INPUT_GZIP " != " false" ] && [ " $INPUT_GZIP " != " folders" ]; then
49
+ >&2 echo " ::error::invalid: gzip (see log for details)"
49
50
>&2 printf " \nERR: Invalid input: 'gzip' can only be not set, or one of: true, false, folders\n"
50
51
>&2 printf " \tNote: It defines what to do with assets before uploading them.\n\n"
51
52
>&2 printf " Try:\n"
52
53
>&2 printf " \tuses: %s\n" " $PKG "
53
54
>&2 printf " \twith:\n"
54
55
>&2 printf " \t gzip: true\n"
55
- >&2 printf " \t ...\n"
56
- echo " ::error::invalid: gzip (see log for details)"
56
+ >&2 printf " \t ...\n\n"
57
57
exit 1
58
58
fi
59
59
@@ -72,14 +72,14 @@ gh_release_api() {
72
72
release_id=" $( gh_release_api " tags/$tag " | jq -r ' .id | select(. != null)' ) "
73
73
74
74
if [ -n " $release_id " ] && [ " $INPUT_ALLOW_OVERRIDE " != " true" ]; then
75
+ >&2 echo " ::error::missing: allow_override (see log for details)"
75
76
>&2 printf " \nERR: Release for tag='%s' already exists, and overriding is not allowed.\n" " $tag "
76
77
>&2 printf " \tNote: Either use different 'tag:' name, or set 'allow_override:'\n\n"
77
78
>&2 printf " Try:\n"
78
79
>&2 printf " \tuses: %s\n" " $PKG "
79
80
>&2 printf " \twith:\n"
80
81
>&2 printf " \t ...\n"
81
- >&2 printf " \t allow_override: true\n"
82
- echo " ::error::missing: allow_override (see log for details)"
82
+ >&2 printf " \t allow_override: true\n\n"
83
83
exit 1
84
84
fi
85
85
@@ -133,9 +133,9 @@ status_code="$(jq -nc \
133
133
" $full_url " ) "
134
134
135
135
if [ " $status_code " != " 200" ] && [ " $status_code " != " 201" ]; then
136
+ >&2 echo " ::error::failed to create release (see log for details)"
136
137
>&2 printf " \n\tERR: %s to Github release has failed\n" " $method "
137
138
>&2 jq . < " $TMP /$method .json"
138
- echo " ::error::failed to create release (see log for details)"
139
139
exit 1
140
140
fi
141
141
@@ -181,6 +181,7 @@ for entry in $INPUT_FILES; do
181
181
for file in $asset_path ; do
182
182
# Error out on the only illegal combination: compression disabled AND folder provided
183
183
if [ " $INPUT_GZIP " = " false" ] && [ -d " $file " ]; then
184
+ >&2 echo " ::error::invalid: gzip and files combination (see log for details)"
184
185
>&2 printf " \nERR: Invalid configuration: 'gzip' cannot be set to 'false' while there are 'folders/' provided.\n"
185
186
>&2 printf " \tNote: Either set 'gzip: folders', or remove directories from the 'files:' list.\n\n"
186
187
>&2 printf " Try:\n"
@@ -191,7 +192,6 @@ for entry in $INPUT_FILES; do
191
192
>&2 printf " \t files: >\n"
192
193
>&2 printf " \t README.md\n"
193
194
>&2 printf " \t my-artifacts/\n"
194
- echo " ::error::invalid: gzip and files combination (see log for details)"
195
195
exit 1
196
196
fi
197
197
@@ -247,9 +247,9 @@ for asset in "$assets"/*; do
247
247
" $upload_url /$release_id /assets?name=$file_name " ) "
248
248
249
249
if [ " $status_code " -ne " 201" ]; then
250
+ >&2 echo " ::error::failed to upload asset: $file_name (see log for details)"
250
251
>&2 printf " \n\tERR: Failed asset upload: %s\n" " $file_name "
251
252
>&2 jq . < " $TMP /$file_name .json"
252
- echo " ::error::failed to upload asset: $file_name (see log for details)"
253
253
exit 1
254
254
fi
255
255
done
@@ -271,9 +271,9 @@ status_code="$(curl -sS -X PATCH -d '{"draft": false}' \
271
271
" $releases_url /$release_id " ) "
272
272
273
273
if [ " $status_code " != " 200" ]; then
274
+ >&2 echo " ::error::failed to complete release (see log for details)"
274
275
>&2 printf " \n\tERR: Final publishing of the ready Github Release has failed\n"
275
276
>&2 jq . < " $TMP /publish.json"
276
- echo " ::error::failed to complete release (see log for details)"
277
277
exit 1
278
278
fi
279
279
0 commit comments