Replaced with a very small shell script
[emoji-stealer.git] / release.sh
1 #!/bin/sh
2 LINUX_OS=linux
3 WINDOWS_OS=windows
4 MAC_OS=darwin
5 LINUX_ARCHS="amd64 386"
6 WINDOWS_ARCHS="amd64 386"
7 MAC_ARCHS="amd64"
8 OSES="$LINUX_OS $WINDOWS_OS $MAC_OS"
9
10 PROGNAME=`cat PROGNAME`
11 VERSION=`cat VERSION`
12
13 clean_exe() {
14    test -f $PROGNAME$ext && rm $PROGNAME$ext
15 }
16
17 clean() {
18     clean_exe
19     test -f $PROGNAME-$VERSION-$os-${arch}.zip && rm $PROGNAME-$VERSION-$os-${arch}.zip
20 }
21
22 compile() {
23     GOOS=$os GOARCH=$arch go build -o $PROGNAME$ext
24 }
25
26 zip_executable() {
27     zip $PROGNAME-$VERSION-$os-$arch.zip $PROGNAME$ext
28 }
29
30 run() {
31     clean
32     compile
33     zip_executable
34     clean_exe
35 }
36
37 for os in $OSES
38 do
39     case $os in
40         $LINUX_OS)
41             ext=""
42             for arch in $LINUX_ARCHS
43             do
44                 run
45             done
46                    ;;
47         $MAC_OS)
48             ext=""
49             for arch in $MAC_ARCHS
50             do
51                 run
52             done
53             ;;
54         $WINDOWS_OS)
55             ext=".exe"
56             for arch in $WINDOWS_ARCHS
57             do
58                 run
59             done
60             ;;
61     esac
62 done