forked from michenriksen/aquatone
-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.sh
executable file
·65 lines (49 loc) · 1.43 KB
/
build.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
#!/bin/bash
BUILD_FOLDER=build
VERSION=$(cat core/banner.go | grep Version | cut -d '"' -f 2)
bin_dep() {
BIN=$1
which $BIN > /dev/null || { echo "[-] Dependency $BIN not found !"; exit 1; }
}
create_exe_archive() {
bin_dep 'zip'
OUTPUT=$1
echo "[*] Creating archive $OUTPUT ..."
zip -j "$OUTPUT" aquatone.exe ../README.md ../LICENSE.txt > /dev/null
rm -rf aquatone aquatone.exe
}
create_archive() {
bin_dep 'zip'
OUTPUT=$1
echo "[*] Creating archive $OUTPUT ..."
zip -j "$OUTPUT" aquatone ../README.md ../LICENSE.txt > /dev/null
rm -rf aquatone aquatone.exe
}
build_linux_amd64() {
echo "[*] Building linux/amd64 ..."
GOOS=linux GOARCH=amd64 go build -o aquatone ..
}
build_linux_arm64() {
echo "[*] Building linux/arm64 ..."
GOOS=linux GOARCH=arm go build -o aquatone ..
}
build_macos_amd64() {
echo "[*] Building darwin/amd64 ..."
GOOS=darwin GOARCH=amd64 go build -o aquatone ..
}
build_windows_amd64() {
echo "[*] Building windows/amd64 ..."
GOOS=windows GOARCH=amd64 go build -o aquatone.exe ..
}
rm -rf $BUILD_FOLDER
mkdir $BUILD_FOLDER
cd $BUILD_FOLDER
build_linux_amd64 && create_archive aquatone_linux_amd64_$VERSION.zip
build_linux_arm64 && create_archive aquatone_linux_arm64_$VERSION.zip
build_macos_amd64 && create_archive aquatone_macos_amd64_$VERSION.zip
build_windows_amd64 && create_exe_archive aquatone_windows_amd64_$VERSION.zip
shasum -a 256 * > checksums.txt
echo
echo
du -sh *
cd --