forked from rcaught/hosts-override
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrelease.sh
More file actions
executable file
·29 lines (23 loc) · 853 Bytes
/
Copy pathrelease.sh
File metadata and controls
executable file
·29 lines (23 loc) · 853 Bytes
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
#!/bin/bash
set -eu
echo 'Compiling hosts-override for multiple platforms'
# Triple is so we can keep using OS names in existing public documentation rather
# than updating and missing a reference somewhere, specifically macos over darwin
platforms=("windows/amd64/windows" "darwin/amd64/macos" "linux/amd64/linux")
tmp_dir=$(mktemp -d -t hostsoverride-XXXXXXXXX)
if [[ ! -e 'release' ]]; then
mkdir 'release'
fi
for platform in "${platforms[@]}"; do
echo 'Building for '$platform
platform_split=(${platform//\// })
GOOS=${platform_split[0]}
GOARCH=${platform_split[1]}
output_name='hosts-override'
if [ $GOOS = "windows" ]; then
output_name+='.exe'
fi
env GOOS=$GOOS GOARCH=$GOARCH go build -o $tmp_dir'/'$output_name
zip -j 'release/'${platform_split[2]}'.zip' $tmp_dir'/'$output_name
done
echo 'Completed all platforms'