master
sh 26 lines 541 Bytes
Raw
1 #!/usr/bin/env bash
2 # vim: set expandtab sw=2 ts=2:
3
4 # bash safe mode
5 set -euo pipefail
6 IFS=$'\n\t'
7
8 # readlink doesn't work on macos
9 OUTPUT="${1:-go-ipfs-source.tar.gz}"
10 if ! [[ "$OUTPUT" = /* ]]; then
11 OUTPUT="$PWD/$OUTPUT"
12 fi
13
14 GOCC=${GOCC=go}
15
16 TEMP="$(mktemp -d)"
17 cp -r . "$TEMP"
18 ( cd "$TEMP" &&
19 echo $PWD &&
20 $GOCC mod vendor &&
21 (git describe --always --match=NeVeRmAtCh --dirty 2>/dev/null || true) > .tarball &&
22 chmod -R u=rwX,go=rX "$TEMP" # normalize permissions
23 tar -czf "$OUTPUT" --exclude="./.git" .
24 )
25
26 rm -rf "$TEMP"