-
Notifications
You must be signed in to change notification settings - Fork 3
/
build_upload.sh
executable file
·62 lines (51 loc) · 1.15 KB
/
build_upload.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
#!/bin/bash -x
set -e
echo "Build and upload binaries to calaos.fr"
if [ "x$UPLOAD_KEY" == "x" ]; then
echo "Error, UPLOAD_KEY is not set"
exit 1
fi
function upload_file()
{
FNAME=$1
HASH=$(sha256sum $FNAME | cut -d' ' -f1)
INSTALLPATH=$2
echo "Uploading file $FNAME"
curl -X POST \
-H "Content-Type: multipart/form-data" \
-F "upload_key=$UPLOAD_KEY" \
-F "upload_folder=$INSTALLPATH" \
-F "upload_sha256=$HASH" \
-F "upload_file=@$FNAME" \
-F "upload_replace=true" \
--progress-bar \
https://calaos.fr/mooltipass/upload -o upload.log
rm -f upload.log
}
BIN="mc-cli"
echo ">> Building windows bin"
export GO15VENDOREXPERIMENT=1
export CGO_ENABLED=0
export GOARCH=386
export GOOS=windows
go env
rm -f ${BIN}.exe
go get -d
go build -v
upload_file ${BIN}.exe "tools/windows"
echo ">> Building linux bin"
export GOARCH=amd64
export GOOS=linux
go env
rm -f $BIN ${BIN}.exe
go get -d
go build -v
upload_file ${BIN} "tools/linux"
echo ">> Building macos bin"
export GOARCH=amd64
export GOOS=darwin
go env
rm -f $BIN
go get -d
go build -v
upload_file ${BIN} "tools/macos"