forked from louketo/louketo-proxy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
release.sh
executable file
·58 lines (49 loc) · 1.87 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
#!/bin/bash -e
NAME="louketo-proxy"
PLATFORMS="darwin linux windows"
ARCHITECTURES="amd64"
GIT_SHA=$(git --no-pager describe --always --dirty)
BUILD_TIME=$(date '+%s')
LFLAGS="-X main.gitsha=$GIT_SHA -X main.compiled=$BUILD_TIME"
DIR="$PWD"
# Release an Alpha so we can provide all the binaries for people to give it a try
VERSION="1.0.0-alpha"
echo "Version: $VERSION"
TMP=`mktemp -d`
# Perform some clean up before building it
clean() {
rm -rf ./bin/* 2>/dev/null
rm -rf ./release/* 2>/dev/null
}
release() {
mkdir -p release
for PLATFORM in $PLATFORMS; do
EXT=""
if [ "$PLATFORM" == "windows" ]; then
EXT=".exe"
fi
for ARCH in $ARCHITECTURES; do
env GOOS=$PLATFORM GOARCH=$ARCH CGO_ENABLED=0 go build -a -tags netgo -ldflags " -w $LFLAGS" -o bin/$NAME$EXT
tar -czvf release/"$NAME-$PLATFORM-$ARCH".tar.gz -C bin/ $NAME$EXT >/dev/null
sha1sum release/"$NAME-$PLATFORM-$ARCH".tar.gz | cut -d " " -f1 > release/"$NAME-$PLATFORM-$ARCH".tar.gz.sha1
# Test if tar file is not corrupted
if ! tar -tf release/"$NAME-$PLATFORM-$ARCH".tar.gz &>/dev/null;then
echo "Corrupted tar file"
exit 1
fi
done
done
}
echo "------------------------------------------------------------------------------------------------------------"
echo "Building: $NAME-$VERSION"
echo ""
clean
release
# TODO Use goreleases instead
#echo "------------------------------------------------------------------------------------------------------------"
#echo "Upload to jboss.org:"
#echo ""
#rsync -rv --protocol=28 $DIR/release/* [email protected]:/downloads_htdocs/keycloak/$VERSION/louketo/
echo "------------------------------------------------------------------------------------------------------------"
echo "Done"
echo "------------------------------------------------------------------------------------------------------------"