forked from coreos/updateservicectl
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild-release
executable file
·75 lines (57 loc) · 1.16 KB
/
build-release
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
64
65
66
67
68
69
70
71
72
73
74
75
#!/bin/sh -e
function usage {
echo "usage: ${0} <git-ref>"
exit 1
}
VER=$1
if [ -z $VER ]; then
usage
fi
function checkout {
proj=${1}
ver=${2}
if [ ! -d ${proj} ]; then
git clone git@github.com:coreos-inc/${proj}.git
fi
cd ${proj}
git checkout master
git fetch --all
git reset --hard origin/master
git checkout $ver
cd -
}
function build {
proj=${1}
ver=${2}
cd ${proj}
./build
cd -
}
function package {
proj=${1}
target=${2}
ccdir="${proj}/bin/${GOOS}_${GOARCH}"
if [ -d ${ccdir} ]; then
cp ${ccdir}/${proj}* ${target}
else
cp ${proj}/bin/${proj} ${target}
fi
cp ${proj}/README.md ${target}/README.md
cp -R ${proj}/Documentation ${target}
}
mkdir release
cd release
checkout updatectl ${VER}
for i in darwin windows linux; do
export GOOS=${i}
export GOARCH="amd64"
build updatectl ${VER}
TARGET="updatectl-${VER}-${GOOS}-${GOARCH}"
mkdir ${TARGET}
package updatectl ${TARGET}
if [ ${GOOS} == "linux" ]; then
tar cvvfz ${TARGET}.tar.gz ${TARGET}
else
zip -r ${TARGET}.zip ${TARGET}
fi
done