mirror of
https://github.com/outbackdingo/UltraGrid.git
synced 2026-03-03 06:14:32 +00:00
ensure URL is not empty
see also f4f54fda - adding -f to curl caused URL to be empty if release
was not found (was to be created) - the GH REST API returns 404 with
a valid body without -f but fails with empty. Since `-o pipefail` is not
used, the curl error was not used because last command of pipeline is jq.
33 lines
800 B
Bash
Executable File
33 lines
800 B
Bash
Executable File
#!/bin/sh -eux
|
|
#
|
|
# Ensures that tag "continuous" is present is released on GH. This is required for
|
|
# zsync AppImage release asset.
|
|
#
|
|
|
|
dir=$(dirname "$0")
|
|
# shellcheck source=/dev/null
|
|
. "$dir/json-common.sh"
|
|
|
|
sudo apt install jq
|
|
URL=$(curl -S -H "Authorization: token $GITHUB_TOKEN" -X GET\
|
|
"https://api.github.com/repos/$GITHUB_REPOSITORY/releases/tags/continuous" |
|
|
jq -r '.url')
|
|
if [ "${URL?}" != null ]; then # release exists
|
|
exit 0
|
|
fi
|
|
git fetch --prune --unshallow --tags -f
|
|
if git tag continuous; then # tag may or may not exists
|
|
git push origin refs/tags/continuous
|
|
fi
|
|
tmp=$(mktemp)
|
|
status=$(curl -S -H "Authorization: token $GITHUB_TOKEN" -X POST "$URL" -T - -o "$tmp" -w '%{http_code}' <<EOF
|
|
{
|
|
"tag_name": "continuous"}
|
|
}
|
|
EOF
|
|
)
|
|
|
|
check_status "$status" "$tmp"
|
|
rm "$tmp"
|
|
|