-
Notifications
You must be signed in to change notification settings - Fork 6
/
make_release.sh
executable file
·66 lines (54 loc) · 1.17 KB
/
make_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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/bin/bash
set -eo pipefail
rm -rf bin 2> /dev/null
if [ -z "$1" ]; then
echo "Please provide a version number"
exit 1
fi
TARGETS=(
# macOS
"darwin|arm64"
"darwin|amd64"
# Linux
"linux|386"
"linux|arm"
"linux|arm64"
"linux|amd64"
# Windows
"windows|386"
"windows|amd64"
"windows|arm"
"windows|arm64"
# FreeBSD
"freebsd|386"
"freebsd|arm"
"freebsd|amd64"
"freebsd|arm64"
# OpenBSD
"openbsd|386"
"openbsd|arm"
"openbsd|amd64"
"openbsd|arm64"
# NetBSD
"netbsd|386"
"netbsd|arm"
"netbsd|amd64"
"netbsd|arm64"
)
mkdir bin
touch bin/checksums.txt
for target in "${TARGETS[@]}"; do
IFS='|' read -ra target <<< "$target"
GOOS=${target[0]}
GOARCH=${target[1]}
OUTPUT="bin/radiogogo"
# Output name: adjust for windows
if [ "$GOOS" == "windows" ]; then
OUTPUT+=".exe"
fi
echo "Building for $GOOS/$GOARCH"
GOOS=$GOOS GOARCH=$GOARCH go build -o $OUTPUT
zip -j "bin/radiogogo_$1_${GOOS}_${GOARCH}.zip" $OUTPUT
rm -rf $OUTPUT
cd bin && shasum -a 256 "radiogogo_$1_${GOOS}_${GOARCH}.zip" >> "checksums.txt" && cd ..
done