-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild
executable file
·32 lines (24 loc) · 895 Bytes
/
build
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
#!/bin/bash
version=$1
release_type=$2
if [ "${#version}" -eq 0 ]; then
echo -e "Please specify version of the build\nExample: ./build v1.0 ー will compile and archive to v1.0-release.tar.gz"
exit
fi
if [ "${#release_type}" -eq 0 ]; then
release_type="release"
fi
bin_folder="bin"
release_folder="./release"
sample_config="config.sample.yml"
if [ ! -d "$release_folder" ]; then
mkdir "$release_folder"
fi
echo "* Started compiling binaries"
GOOS=windows go build -o ${bin_folder}/windows.exe main.go
GOOS=darwin go build -o ${bin_folder}/darwin main.go
go build -o ${bin_folder}/linux main.go
echo "* Binaries successfully compiled in the ${bin_folder} folder"
archive_name="${version}-${release_type}.tar.gz"
echo "* Adding binaries to the archive ${release_folder}/${archive_name}"
tar -zcvf ${release_folder}/${archive_name} ${bin_folder} ${sample_config} > /dev/null