-
Notifications
You must be signed in to change notification settings - Fork 4
/
prepare_hiro_release.sh
executable file
·65 lines (50 loc) · 1021 Bytes
/
prepare_hiro_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
#!/usr/bin/env bash
if [ "$#" -ne 1 ]
then
echo "Usage: ./prepare_hiro_release.sh <version number>"
exit 1
fi
function createRelease {
release_name="$RELEASE_BASE-$1-$2"
release_dir="$RELEASES_DIR/$release_name"
# Create the release dir
mkdir -p $release_dir
# Cross compile for the given OS/Arch
GOOS=$1 GOARCH=$2 go build -o $release_dir/$3
# Compress the binary (junk paths, quiet)
zip -j -q -r $release_dir.zip $release_dir
# Remove the binary
rm $release_dir/$3
# Remove the release dir
rmdir $release_dir
}
RELEASES_DIR="/tmp/hiro/releases/$1"
RELEASE_BASE="hiro-$1"
# Architectures to create releases for
WINDOWS_386=(
windows
386
hiro.exe
)
WINDOWS_amd64=(
windows
amd64
hiro.exe
)
DARWIN_amd64=(
darwin
amd64
hiro
)
LINUX_amd64=(
linux
amd64
hiro
)
# Create the releases
createRelease ${WINDOWS_386[@]}
createRelease ${WINDOWS_amd64[@]}
createRelease ${DARWIN_amd64[@]}
createRelease ${LINUX_amd64[@]}
# Open the releases dir
open $RELEASES_DIR