Skip to content

Commit

Permalink
Added build release script
Browse files Browse the repository at this point in the history
  • Loading branch information
andygrunwald committed Aug 10, 2015
1 parent 37dd6b3 commit 48b0448
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,5 @@ _testmain.go

# Application
jitic
release/
jitic-v*
51 changes: 51 additions & 0 deletions scripts/build-release
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#!/bin/sh -e

#
# This script is inspired by coreos/etcd.
# The credits goes to coreos.
# This version is only a (slightly) modified version.
#
# Thanks to open source and thanks to CoreOS / etcd.
#
# @link https://github.com/coreos/etcd/blob/master/scripts/build-release
#

VER=$1
PROJ="jitic"

if [ -z "$1" ]; then
echo "Usage: ${0} VERSION" >> /dev/stderr
exit 255
fi

set -u

function main {
mkdir release

for os in darwin windows linux freebsd; do
export GOOS=${os}
export GOARCH="amd64"

TARGET="jitic-${VER}-${GOOS}-${GOARCH}"
mkdir ${TARGET}
cp README.md ${TARGET}/README.md

local ext=""
if [ ${GOOS} == "windows" ]; then
ext=".exe"
fi

go build -o ${TARGET}/jitic${ext}

if [ ${GOOS} == "linux" ]; then
tar cfz release/${TARGET}.tar.gz ${TARGET}
echo "Wrote release/${TARGET}.tar.gz"
else
zip -qr release/${TARGET}.zip ${TARGET}
echo "Wrote release/${TARGET}.zip"
fi
done
}

main

0 comments on commit 48b0448

Please sign in to comment.