-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrelease.sh
executable file
·74 lines (62 loc) · 1.13 KB
/
release.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
66
67
68
69
70
71
72
73
74
#!/bin/bash
## Script to release grepj
## Build Go project for multiple architectures - http://golang.org/doc/install/source
## Publish to s3
OUT=grepj
SRC="$OUT.go"
DIST=release
S3_BUCKET=s3://grepj
declare -r PLATFORMS=(
"darwin"
"darwin"
"linux"
"linux"
"windows"
"windows"
)
declare -r ARCHS=(
"amd64"
"386"
"amd64"
"386"
"amd64"
"386"
)
declare -r EXTENSIONS=(
""
""
""
""
".exe"
".exe"
)
function clean {
rm -rf $DIST
echo "Clean"
}
function build_one {
GOOS=$1 GOARCH=$2 go build -o "$DIST/$1_$2/$OUT$3" $SRC
echo "Built for $1 $2"
}
function build {
i=0
while [ $i -lt ${#PLATFORMS[*]} ]; do
build_one ${PLATFORMS[$i]} ${ARCHS[$i]} ${EXTENSIONS[$i]}
i=$(( $i + 1 ))
done
}
function release_one {
s3cmd put --acl-public --add-header "Cache-Control: no-cache" \
"$DIST/$1_$2/$OUT$3" "$S3_BUCKET/$DIST/$1_$2/$OUT$3"
echo "Release $1 $2 $3"
}
function release {
i=0
while [ $i -lt ${#PLATFORMS[*]} ]; do
release_one ${PLATFORMS[$i]} ${ARCHS[$i]} ${EXTENSIONS[$i]}
i=$(( $i + 1 ))
done
}
clean
build
release