Skip to content

Commit 230d9ca

Browse files
committed
scripts: collection of related build scripts
1 parent 044edf3 commit 230d9ca

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed

scripts/package.sh

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
#!/bin/sh
2+
3+
check_err()
4+
{
5+
if [ "$1" -ne "0" ]; then
6+
echo "Error # ${1} : ${2}"
7+
exit ${1}
8+
fi
9+
}
10+
11+
package()
12+
{
13+
VERSION=$1
14+
if [ -z "$VERSION" ]; then
15+
echo "$0 require version argument"
16+
return 1
17+
fi
18+
19+
echo "packaging version $VERSION"
20+
21+
echo "packaging for Apple's OSX"
22+
make build-osx
23+
tar -czvf tob-${VERSION}.darwin-amd64.tar.gz tob
24+
rm tob
25+
26+
echo "packaging for Linux"
27+
make build-linux
28+
tar -czvf tob-${VERSION}.linux-amd64.tar.gz tob
29+
rm tob
30+
31+
echo "packaging for Windows"
32+
make build-win
33+
zip tob-${VERSION}.win-amd64.zip tob.exe
34+
rm tob.exe
35+
36+
echo "generate sha256sum ..."
37+
sha256sum tob-${VERSION}.darwin-amd64.tar.gz >> sha256sums.txt
38+
sha256sum tob-${VERSION}.linux-amd64.tar.gz >> sha256sums.txt
39+
sha256sum tob-${VERSION}.win-amd64.zip >> sha256sums.txt
40+
41+
return 0
42+
}
43+
44+
package "$@"
45+
check_err $? "package returned error"
46+
47+
# How to run this script
48+
# ./package.sh YOUR_NEW_VERSION_HERE
49+
50+
# eg:
51+
# ./package.sh 1.0.0

0 commit comments

Comments
 (0)