Skip to content

Commit

Permalink
simple dist script
Browse files Browse the repository at this point in the history
  • Loading branch information
jehiah committed Sep 30, 2021
1 parent 1016723 commit 7804c4e
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
little_bigtable.db
little_bigtable
build
dist
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PREFIX=/usr/local
BINDIR=${PREFIX}/bin
DESTDIR=
BLDDIR = build
BLDDIR=build
BLDFLAGS=
EXT=
ifeq (${GOOS},windows)
Expand Down
33 changes: 33 additions & 0 deletions dist.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/bash

# 1. commit to bump the version (little_bigtable.go)
# 2. tag that commit
# 3. use dist.sh to produce tar.gz for all platforms
# 4. update the release metadata on github / upload the binaries

set -e

DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"

version=$(awk '/version / {print $NF}' < $DIR/little_bigtable.go | sed 's/"//g')
goversion=$(go version | awk '{print $3}')

echo "... running tests"
./test.sh

mkdir -p dist
for target in "linux/amd64"; do
os=${target%/*}
arch=${target##*/}
echo "... building v$version for $os/$arch"
BUILD=$(mktemp -d ${TMPDIR:-/tmp}/build-XXXXX)
TARGET="little_bigtable-$version.$os-$arch.$goversion"
GOOS=$os GOARCH=$arch \
go build --tags "$os" -o $BUILD/$TARGET .
pushd $BUILD
sudo chown -R 0:0 $TARGET
tar czvf $TARGET.tar.gz $TARGET
mv $TARGET.tar.gz $DIR/dist
popd
sudo rm -r $BUILD
done

0 comments on commit 7804c4e

Please sign in to comment.