git.iko.soy/typeable/oauth2-proxy
on v2.2 help sign in
33 lines 933 B history raw
1#!/bin/bash
2# build binary distributions for linux/amd64 and darwin/amd64
3set -e
5DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
6echo "working dir $DIR"
7mkdir -p $DIR/dist
8mkdir -p $DIR/.godeps
9export GOPATH=$DIR/.godeps:$GOPATH
10GOPATH=$DIR/.godeps gpm install
12os=$(go env GOOS)
13arch=$(go env GOARCH)
14version=$(cat $DIR/version.go | grep "const VERSION" | awk '{print $NF}' | sed 's/"//g')
15goversion=$(go version | awk '{print $3}')
17echo "... running tests"
18./test.sh
20for os in windows linux darwin; do
21 echo "... building v$version for $os/$arch"
22 EXT=
23 if [ $os = windows ]; then
24 EXT=".exe"
25 fi
26 BUILD=$(mktemp -d ${TMPDIR:-/tmp}/oauth2_proxy.XXXXXX)
27 TARGET="oauth2_proxy-$version.$os-$arch.$goversion"
28 GOOS=$os GOARCH=$arch CGO_ENABLED=0 go build -o $BUILD/$TARGET/oauth2_proxy$EXT || exit 1
29 pushd $BUILD
30 tar czvf $TARGET.tar.gz $TARGET
31 mv $TARGET.tar.gz $DIR/dist
32 popd
33done