-
Notifications
You must be signed in to change notification settings - Fork 106
/
release.sh
executable file
·63 lines (47 loc) · 1.17 KB
/
release.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/bin/bash
ORG=justone
NAME=dockviz
ARCHS="darwin/amd64 linux/amd64 windows/amd64"
set -ex
if [[ ! $(type -P gox) ]]; then
echo "Error: gox not found."
echo "To fix: run 'go get github.com/mitchellh/gox', and/or add \$GOPATH/bin to \$PATH"
exit 1
fi
if [[ -z $GITHUB_TOKEN ]]; then
echo "Error: GITHUB_TOKEN not set."
exit 1
fi
if [[ ! $(type -P github-release) ]]; then
echo "Error: github-release not found."
exit 1
fi
VER=$1
if [[ -z $VER ]]; then
echo "Need to specify version."
exit 1
fi
PRE_ARG=
if [[ $VER =~ pre ]]; then
PRE_ARG="--pre-release"
fi
# git tag $VER
echo "Building $VER"
echo
rm -v ${NAME}* || true
gox -ldflags "-X main.version=$VER" -osarch="$ARCHS"
echo "* " > desc
echo "" >> desc
echo "\`\`\`" >> desc
echo "$ sha1sum ${NAME}_*" >> desc
sha1sum ${NAME}_* >> desc
echo "$ sha256sum ${NAME}_*" >> desc
sha256sum ${NAME}_* >> desc
echo "\`\`\`" >> desc
vi desc
git push --tags
sleep 2
cat desc | github-release release $PRE_ARG --user ${ORG} --repo ${NAME} --tag $VER --name $VER --description -
for file in ${NAME}_*; do
github-release upload --user ${ORG} --repo ${NAME} --tag $VER --name $file --file $file
done