#!/bin/sh -x
rm -rf tendermint
GOPATH="`pwd`/tendermint"
export GOPATH
mkdir -p $GOPATH/src/github.com/tendermint
git clone --depth 1 https://github.com/tendermint/tendermint $GOPATH/src/github.com/tendermint/tendermint
( cd $GOPATH/src/github.com/tendermint/tendermint
  export GO111MODULE=on
  go mod vendor -v
)
chmod -R a+rw tendermint
tar cvf - --exclude .git tendermint | xz -9 >tendermint-`date '+%Y%m%d'`.tar.xz
rm -rf tendermint
