release.sh 1.22 KB
Newer Older
1
#!/bin/bash
Nigel McNie's avatar
Nigel McNie committed
2
3
4
#
# Builds release tarballs of Mahara at the given version, ready for
# distribution
5
6
7
set -e

print_usage() {
Nigel McNie's avatar
Nigel McNie committed
8
9
10
    echo "Usage is release.sh [version]"
    echo "e.g. release.sh 0.6.2"
    echo "e.g. release.sh 1.0.0alpha1"
11
12
}

Nigel McNie's avatar
Nigel McNie committed
13
14
15
16
17
18
19
20
if [ -z "$1" ]; then
    print_usage
    exit 1
fi

MAJOR=${1:0:3}
MINOR=${1:4:1}
MICRO=${1:5}
21
22
23
24
BUILDDIR="/tmp/mahara_release"
CURRENTDIR="`pwd`"

if [ -z "${MAJOR}" ] || [ -z "${MINOR}" ]; then
Nigel McNie's avatar
Nigel McNie committed
25
26
    print_usage
    exit 1
27
28
fi

Nigel McNie's avatar
Nigel McNie committed
29
30
VERSION="${MAJOR}.${MINOR}${MICRO}"

31
32
33
34
35
36
37
38
39
40
41
42
43
44
if [ -d ${BUILDDIR} ]; then
    rm -rf ${BUILDDIR}
fi

mkdir ${BUILDDIR}

pushd ${BUILDDIR}

# Get the stable branch
git clone -n "http://git.catalyst.net.nz/mahara.git" mahara

pushd ${BUILDDIR}/mahara

# Switch to the release tag
45
#git checkout -b "${MAJOR}_STABLE" "origin/${MAJOR}_STABLE"
Nigel McNie's avatar
Nigel McNie committed
46
47
RELEASETAG="`echo $VERSION | tr '[:lower:]' '[:upper:]'`_RELEASE"
git checkout $RELEASETAG
48

49
# Remove git stuff
50
rm .git -rf
51
find . -name '.gitignore' -exec rm {} \;
52
53

# Pack MochiKit
54
bash scripts/pack.sh
55
56
57

popd

Nigel McNie's avatar
Nigel McNie committed
58
mv mahara mahara-${VERSION}
59

Nigel McNie's avatar
Nigel McNie committed
60
61
62
tar zcf ${CURRENTDIR}/mahara-${VERSION}.tar.gz mahara-${VERSION}
tar jcf ${CURRENTDIR}/mahara-${VERSION}.tar.bz2 mahara-${VERSION}
zip -qrT9 ${CURRENTDIR}/mahara-${VERSION}.zip mahara-${VERSION}
63
64
65

popd
#rm -rf ${BUILDDIR}