etcd/scripts/build-release
Brandon Philips 538ce935f0 scripts: import script from 0.5 release
It isn't pretty but this was the tool used to build the zip and tar
files for 0.5
2014-10-27 12:18:24 -07:00

60 lines
967 B
Bash
Executable File

#!/bin/sh -e
VER=$1
function build {
proj=${1}
ver=${2}
if [ ! -d ${proj} ]; then
git clone https://github.com/coreos/${proj}
fi
cd ${proj}
git checkout master
git fetch --all
git reset --hard origin/master
git checkout $ver
./build
cd -
}
function package {
target=${1}
ccdir="${proj}/bin/${GOOS}_${GOARCH}"
if [ -d ${ccdir} ]; then
cp ${ccdir}/etcdctl ${target}
cp ${ccdir}/etcd ${target}
else
cp ${proj}/bin/etcd ${target}
cp ${proj}/bin/etcdctl ${target}
fi
cp etcd/README.md ${target}/README.md
cp etcd/etcdctl/README.md ${target}/README-etcdctl.md
cp -R etcd/Documentation/0.5 ${target}/Documentation
}
mkdir release
cd release
for i in darwin windows linux; do
export GOOS=${i}
export GOARCH="amd64"
build etcd ${VER}
TARGET="etcd-${VER}-${GOOS}-${GOARCH}"
mkdir ${TARGET}
package ${TARGET}
if [ ${GOOS} == "linux" ]; then
tar cvvfz ${TARGET}.tar.gz ${TARGET}
else
zip -r ${TARGET}.zip ${TARGET}
fi
done