forked from NobodyXu/swaystatus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdraft_github_release.sh
executable file
·50 lines (41 loc) · 1.41 KB
/
draft_github_release.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/bin/sh -ex
get_libc_name() {
libc=$(ldd src/release_build/swaystatus | grep libc | cut -d '>' -f 2 | sed 's/(.*)$//')
output=$($libc 2>&1)
if echo "$output" | grep -q 'GNU C Library'; then
version="$(echo $output | grep -o 'release version [0-9]*\.[0-9]*' | sed -e 's/release version //')"
echo "glibc-$version"
elif echo "$output" | grep -q 'musl libc'; then
version="$(echo $output | grep -o 'Version [0-9]*\.[0-9]*\.[0-9]*' | sed -e 's/Version //')"
echo "musl-$version"
else
echo unknown libc! >&2
exit 1
fi
}
cd $(dirname $0)
label_postfix="$(arch)-$(uname)-$(get_libc_name)"
if [ $# -lt 1 ] || [ $# -gt 2 ] || [ "$1" = "--help" ] || [ "$1" = "-h" ]; then
echo "Usage: $0 <tag> [Release notes]" >&2
exit 1
fi
tag=$1
if [ $# -eq 2 ]; then
changelogOption="-n"
changelogValue="$2"
else
changelogFile=$(mktemp)
"$EDITOR" "$changelogFile"
changelogOption="-F"
changelogValue="$changelogFile"
fi
./run_all_builds.sh
cp src/release_build/swaystatus "/tmp/swaystatus-with-python-support-$label_postfix"
cp src/release_no_py_build/swaystatus "/tmp/swaystatus-no-python-support-$label_postfix"
git push
exec gh release create "$tag" \
--prerelease \
$changelogOption "$changelogValue" \
-t "swaystatus $tag" \
"/tmp/swaystatus-with-python-support-$label_postfix" \
"/tmp/swaystatus-no-python-support-$label_postfix"