-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
script to tag releases and build binaries
- Loading branch information
Showing
1 changed file
with
34 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#!/usr/bin/env sh | ||
|
||
TAG_NAME="$1" | ||
|
||
if [ -z "$TAG_NAME" ]; then | ||
echo 1>&2 'no tag name given' | ||
exit 1 | ||
fi | ||
|
||
build() { | ||
os=$1 | ||
arch=$2 | ||
echo $os $arch | ||
GOOS=$os GOARCH=$arch go build && tar czf "jqsh${TAG_NAME}.${os}-${arch}.tar.gz" jqsh && rm jqsh | ||
[ $? -eq 0 ] || exit 1 | ||
} | ||
|
||
if [ -n "`git status --porcelain`" ]; then | ||
echo 1>&2 'repository is not clean' | ||
exit 1 | ||
fi | ||
|
||
|
||
if [ -n "`ls *.tar.gz 2>/dev/null`" ]; then | ||
echo 1>&2 'remove previous distribution files' | ||
exit 1 | ||
fi | ||
|
||
git tag -a "$1" | ||
|
||
build darwin amd64 | ||
build linux amd64 | ||
|
||
echo "all distributions built successfully" |