forked from michenriksen/gitrob
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·59 lines (44 loc) · 1.23 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
#!/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" gitrob.exe ../README.md ../LICENSE.txt > /dev/null
rm -rf gitrob gitrob.exe
}
create_archive() {
bin_dep 'zip'
OUTPUT=$1
echo "[*] Creating archive $OUTPUT ..."
zip -j "$OUTPUT" gitrob ../README.md ../LICENSE.md > /dev/null
rm -rf gitrob gitrob.exe
}
build_linux_amd64() {
echo "[*] Building linux/amd64 ..."
GOOS=linux GOARCH=amd64 go build -o gitrob ..
}
build_macos_amd64() {
echo "[*] Building darwin/amd64 ..."
GOOS=darwin GOARCH=amd64 go build -o gitrob ..
}
build_windows_amd64() {
echo "[*] Building windows/amd64 ..."
GOOS=windows GOARCH=amd64 go build -o gitrob.exe ..
}
rm -rf $BUILD_FOLDER
mkdir $BUILD_FOLDER
cd $BUILD_FOLDER
build_linux_amd64 && create_archive gitrob_linux_amd64_$VERSION.zip
build_macos_amd64 && create_archive gitrob_macos_amd64_$VERSION.zip
build_windows_amd64 && create_exe_archive gitrob_windows_amd64_$VERSION.zip
shasum -a 256 * > checksums.txt
echo
echo
du -sh *
cd --