Skip to content

Commit c29afcd

Browse files
committed
Reorder meta sugar
1 parent 65113b0 commit c29afcd

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

entrypoint.sh

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ PKG="meeDamian/[email protected]"
99
#
1010
TOKEN="$INPUT_TOKEN"
1111
if [ -z "$TOKEN" ]; then
12+
>&2 echo "::error::missing: token (see log for details)"
1213
>&2 printf "\nERR: Invalid input: 'token' is required, and must be specified.\n"
1314
>&2 printf "\tNote: It's necessary to interact with Github's API.\n\n"
1415
>&2 printf "Try:\n"
1516
>&2 printf "\tuses: %s\n" "$PKG"
1617
>&2 printf "\twith:\n"
1718
>&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"
2020
exit 1
2121
fi
2222

@@ -30,6 +30,7 @@ fi
3030

3131
# If all ways of getting the $tag failed, exit with an error
3232
if [ -z "$tag" ]; then
33+
>&2 echo "::error::missing: tag (see log for details)"
3334
>&2 printf "\nERR: Invalid input: 'tag' is required, and must be specified.\n"
3435
>&2 printf "Try:\n"
3536
>&2 printf "\tuses: %s\n" "$PKG"
@@ -40,20 +41,19 @@ if [ -z "$tag" ]; then
4041
>&2 printf '\twith:\n'
4142
>&2 printf "\t tag: \${{ env.TAG }}\n"
4243
>&2 printf "\t ...\n\n"
43-
echo "::error::missing: tag (see log for details)"
4444
exit 1
4545
fi
4646

4747
# Verify that gzip: option is set to any of the allowed values
4848
if [ "$INPUT_GZIP" != "true" ] && [ "$INPUT_GZIP" != "false" ] && [ "$INPUT_GZIP" != "folders" ]; then
49+
>&2 echo "::error::invalid: gzip (see log for details)"
4950
>&2 printf "\nERR: Invalid input: 'gzip' can only be not set, or one of: true, false, folders\n"
5051
>&2 printf "\tNote: It defines what to do with assets before uploading them.\n\n"
5152
>&2 printf "Try:\n"
5253
>&2 printf "\tuses: %s\n" "$PKG"
5354
>&2 printf "\twith:\n"
5455
>&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"
5757
exit 1
5858
fi
5959

@@ -72,14 +72,14 @@ gh_release_api() {
7272
release_id="$(gh_release_api "tags/$tag" | jq -r '.id | select(. != null)')"
7373

7474
if [ -n "$release_id" ] && [ "$INPUT_ALLOW_OVERRIDE" != "true" ]; then
75+
>&2 echo "::error::missing: allow_override (see log for details)"
7576
>&2 printf "\nERR: Release for tag='%s' already exists, and overriding is not allowed.\n" "$tag"
7677
>&2 printf "\tNote: Either use different 'tag:' name, or set 'allow_override:'\n\n"
7778
>&2 printf "Try:\n"
7879
>&2 printf "\tuses: %s\n" "$PKG"
7980
>&2 printf "\twith:\n"
8081
>&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"
8383
exit 1
8484
fi
8585

@@ -133,9 +133,9 @@ status_code="$(jq -nc \
133133
"$full_url")"
134134

135135
if [ "$status_code" != "200" ] && [ "$status_code" != "201" ]; then
136+
>&2 echo "::error::failed to create release (see log for details)"
136137
>&2 printf "\n\tERR: %s to Github release has failed\n" "$method"
137138
>&2 jq . < "$TMP/$method.json"
138-
echo "::error::failed to create release (see log for details)"
139139
exit 1
140140
fi
141141

@@ -181,6 +181,7 @@ for entry in $INPUT_FILES; do
181181
for file in $asset_path; do
182182
# Error out on the only illegal combination: compression disabled AND folder provided
183183
if [ "$INPUT_GZIP" = "false" ] && [ -d "$file" ]; then
184+
>&2 echo "::error::invalid: gzip and files combination (see log for details)"
184185
>&2 printf "\nERR: Invalid configuration: 'gzip' cannot be set to 'false' while there are 'folders/' provided.\n"
185186
>&2 printf "\tNote: Either set 'gzip: folders', or remove directories from the 'files:' list.\n\n"
186187
>&2 printf "Try:\n"
@@ -191,7 +192,6 @@ for entry in $INPUT_FILES; do
191192
>&2 printf "\t files: >\n"
192193
>&2 printf "\t README.md\n"
193194
>&2 printf "\t my-artifacts/\n"
194-
echo "::error::invalid: gzip and files combination (see log for details)"
195195
exit 1
196196
fi
197197

@@ -247,9 +247,9 @@ for asset in "$assets"/*; do
247247
"$upload_url/$release_id/assets?name=$file_name")"
248248

249249
if [ "$status_code" -ne "201" ]; then
250+
>&2 echo "::error::failed to upload asset: $file_name (see log for details)"
250251
>&2 printf "\n\tERR: Failed asset upload: %s\n" "$file_name"
251252
>&2 jq . < "$TMP/$file_name.json"
252-
echo "::error::failed to upload asset: $file_name (see log for details)"
253253
exit 1
254254
fi
255255
done
@@ -271,9 +271,9 @@ status_code="$(curl -sS -X PATCH -d '{"draft": false}' \
271271
"$releases_url/$release_id")"
272272

273273
if [ "$status_code" != "200" ]; then
274+
>&2 echo "::error::failed to complete release (see log for details)"
274275
>&2 printf "\n\tERR: Final publishing of the ready Github Release has failed\n"
275276
>&2 jq . < "$TMP/publish.json"
276-
echo "::error::failed to complete release (see log for details)"
277277
exit 1
278278
fi
279279

0 commit comments

Comments
 (0)