forked from holzman/gip
-
Notifications
You must be signed in to change notification settings - Fork 0
/
make_release.sh
executable file
·51 lines (40 loc) · 1.1 KB
/
make_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
#!/bin/bash
set -o noglob
usage='usage: make_release.sh releasename'
tag_regex="*1.3*"
if [ -z "$GIP_SRC_LOCATION" ] ; then
echo 'please set GIP_SRC_LOCATION before proceeding'
exit 1
fi
cd $GIP_SRC_LOCATION
if [ -z "$1" ] ; then
echo $usage
echo "Available releases are: "
echo
git tag -l $tag_regex
exit 2
fi
releasename=$1
git show-ref --verify refs/tags/$releasename >& /dev/null
if [ $? -ne 0 ]; then
echo "Can't find $releasename. Choices are:"
echo
git tag -l $tag_regex
exit 3
fi
if [ -z "$GIP_RELEASE_LOCATION" ] ; then
export GIP_RELEASE_LOCATION=/tmp
fi
tarball=${GIP_RELEASE_LOCATION}/${releasename}.tar
git archive --format=tar --prefix=$releasename/ $releasename > ${tarball}
# add release tag into tarball
tmpdir=`mktemp -d`
cd $tmpdir
mkdir -p ${releasename}/gip/etc
echo $releasename > ${releasename}/gip/etc/gip_release.txt
tar -r -f ${tarball} ${releasename}/gip/etc/gip_release.txt
rm -f ${releasename}/gip/etc/gip_release.txt
cd $GIP_SRC_LOCATION
rm -rf $tmpdir
gzip -f ${tarball}
mv ${tarball}.gz ${GIP_RELEASE_LOCATION}/${releasename}.tgz