Skip to content

Commit f6b4150

Browse files
committed
dist.sh
1 parent 5ca44a6 commit f6b4150

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
vendor
22
pkg
33
bin
4+
dist

dist.sh

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/bin/bash
2+
3+
# build binary distributions for linux/amd64 and darwin/amd64
4+
set -e
5+
6+
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
7+
echo "working dir $DIR"
8+
9+
rm -rf $DIR/vendor
10+
echo "... refreshing vendor directory"
11+
./vendor.sh
12+
13+
echo "... running tests"
14+
gb test || exit 1
15+
16+
arch=$(go env GOARCH)
17+
version=$(cat $DIR/src/cmd/git-open-pull/version.go | grep "const Version" | awk '{print $NF}' | sed 's/"//g')
18+
goversion=$(go version | awk '{print $3}')
19+
20+
mkdir -p dist
21+
for os in linux darwin; do
22+
echo "... building v$version for $os/$arch"
23+
BUILD=$(mktemp -d -t git-open-pull)
24+
TARGET="git-open-pull-$version.$os-$arch.$goversion"
25+
GOOS=$os GOARCH=$arch CGO_ENABLED=0 gb build
26+
mkdir -p $BUILD/$TARGET
27+
cp bin/git-open-pull-$os-$arch $BUILD/$TARGET/git-open-pull
28+
pushd $BUILD >/dev/null
29+
tar czvf $TARGET.tar.gz $TARGET
30+
if [ -e $DIR/dist/$TARGET.tar.gz ]; then
31+
echo "... WARNING overwriting dist/$TARGET.tar.gz"
32+
fi
33+
mv $TARGET.tar.gz $DIR/dist
34+
echo "... built dist/$TARGET.tar.gz"
35+
popd >/dev/null
36+
done

0 commit comments

Comments
 (0)