2016-02-01 04:43:47 +03:00
|
|
|
#!/bin/bash
|
2020-03-05 21:12:14 +03:00
|
|
|
# Usage: script/cross-compile | script/github-release <tag>
|
2015-06-02 20:01:05 +03:00
|
|
|
#
|
|
|
|
# Takes in a list of asset filenames + labels via stdin and uploads them to the
|
|
|
|
# corresponding release on GitHub. The release is created as a draft first if
|
|
|
|
# missing and its body is the git changelog since the previous tagged release.
|
2016-02-01 04:43:47 +03:00
|
|
|
set -e
|
|
|
|
|
2020-03-05 21:12:14 +03:00
|
|
|
tag_name="${1?}"
|
2019-11-15 01:56:24 +03:00
|
|
|
[[ $tag_name == *-* ]] && pre=1 || pre=
|
2016-02-01 04:43:47 +03:00
|
|
|
|
|
|
|
assets=()
|
|
|
|
while read -r filename label; do
|
|
|
|
assets+=( -a "${filename}#${label}" )
|
|
|
|
done
|
|
|
|
|
2019-11-15 01:56:24 +03:00
|
|
|
if hub release --include-drafts | grep -q "^${tag_name}\$"; then
|
|
|
|
hub release edit "$tag_name" -m "" "${assets[@]}"
|
2016-02-01 04:43:47 +03:00
|
|
|
else
|
2020-03-05 21:12:14 +03:00
|
|
|
git tag --list "$tag_name" --format='%(contents:subject)%0a%0a%(contents:body)' | \
|
|
|
|
hub release create ${pre:+--prerelease} -F- "$tag_name" "${assets[@]}"
|
2016-02-01 04:43:47 +03:00
|
|
|
fi
|