Skip to content

Commit 702b530

Browse files
committed
create_[con_]release.sh: handle HTTP status != 200
1 parent f628a16 commit 702b530

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

.github/scripts/create_continuous_release.sh

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
# zsync AppImage release asset.
55
#
66

7+
. $(dirname $0)/json-common.sh
8+
79
sudo apt install jq
810
URL=$(curl -S -H "Authorization: token $GITHUB_TOKEN" -X GET "https://api.github.com/repos/$GITHUB_REPOSITORY/releases/tags/continuous" | jq -r '.url')
911
if [ "$URL" != null ]; then # release exists
@@ -13,8 +15,14 @@ git fetch --prune --unshallow --tags -f
1315
if git tag continuous; then # tag may or may not exists
1416
git push origin refs/tags/continuous
1517
fi
16-
curl -S -H "Authorization: token $GITHUB_TOKEN" -X POST "$URL" -T - <<EOF
18+
TMP=$(mktemp)
19+
STATUS=$(curl -S -H "Authorization: token $GITHUB_TOKEN" -X POST "$URL" -T - -o "$TMP" -w %{http_code} <<EOF
1720
{
1821
"tag_name": "continuous"}
1922
}
2023
EOF
24+
)
25+
26+
check_status "$STATUS" "$TMP"
27+
rm "$TMP"
28+

.github/scripts/create_release.sh

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#!/bin/sh -eux
22

3+
. $(dirname $0)/json-common.sh
4+
35
# Joins line that starts with space to previous:
46
# https://www.gnu.org/software/sed/manual/html_node/Joining-lines.html
57
MERG_LN=':a ; $!N ; s/\n\s+/ / ; ta ; P ; D'
@@ -36,10 +38,16 @@ else
3638
PRERELEASE=false
3739
fi
3840

39-
curl -S -H "Authorization: token $GITHUB_TOKEN" -X $REQ $URL -T - <<EOF
41+
TMP=$(mktemp)
42+
STATUS=$(curl -S -H "Authorization: token $GITHUB_TOKEN" -X $REQ $URL -T - -o "$TMP" -w %{http_code} <<EOF
4043
{
4144
"tag_name": "$TAG", "name": "$TITLE",
4245
"body": "Built $DATE\n\n$SUMMARY",
4346
"draft": false, "prerelease": $PRERELEASE
4447
}
4548
EOF
49+
)
50+
51+
check_status "$STATUS" "$TMP"
52+
rm "$TMP"
53+

0 commit comments

Comments
 (0)