-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathbuild-all.sh
executable file
·52 lines (43 loc) · 1.37 KB
/
build-all.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
#!/bin/sh
if [[ "$1" = "release" ]] ; then
TAG="$2"
: ${TAG:?"Usage: build_all.sh [release] [TAG]"}
git tag | grep $TAG > /dev/null 2>&1
if [ $? -eq 0 ] ; then
echo "$TAG exists, remove it or increment"
exit 1
else
MAJOR=`echo $TAG | awk 'BEGIN {FS = "." } ; { printf $1;}'`
MINOR=`echo $TAG | awk 'BEGIN {FS = "." } ; { printf $2;}'`
BUILD=`echo $TAG | awk 'BEGIN {FS = "." } ; { printf $3;}'`
`sed -i .bak -e "s/Major:.*/Major: $MAJOR,/" \
-e "s/Minor:.*/Minor: $MINOR,/" \
-e "s/Build:.*/Build: $BUILD,/" scaleover_plugin.go`
fi
fi
GOOS=linux GOARCH=amd64 go build
LINUX64_SHA1=`cat scaleover-plugin | openssl sha1`
mkdir -p bin/linux64
mv scaleover-plugin bin/linux64
GOOS=darwin GOARCH=amd64 go build
OSX_SHA1=`cat scaleover-plugin | openssl sha1`
mkdir -p bin/osx
mv scaleover-plugin bin/osx
GOOS=windows GOARCH=amd64 go build
WIN64_SHA1=`cat scaleover-plugin.exe | openssl sha1`
mkdir -p bin/win64
mv scaleover-plugin.exe bin/win64
cat repo-index.yml |
sed "s/osx-sha1/$OSX_SHA1/" |
sed "s/win64-sha1/$WIN64_SHA1/" |
sed "s/linux64-sha1/$LINUX64_SHA1/" |
sed "s/_TAG_/$TAG/" |
cat
#Final build gives developer a plugin to install
go build
if [[ "$1" = "release" ]] ; then
git commit -am "Build version $TAG"
git tag $TAG
echo "Tagged release, 'git push --tags' to move it to github, and copy the output above"
echo "to the cli repo you plan to deploy in"
fi