forked from totten/civix
-
Notifications
You must be signed in to change notification settings - Fork 0
/
release
executable file
·52 lines (44 loc) · 1.52 KB
/
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
#!/bin/bash
## Tag the code, create a clean checkout with dependencies, and build a tarball
set -e
CALLEDPATH=$(dirname $0)
GITURL="$1"
VERSION="$2"
BUILDDIR="$CALLEDPATH/build/civix-$VERSION"
TAG="v${VERSION}"
if [ -z "$1" -o -z "$VERSION" ]; then
echo "usage: $0 <git-url> <version-number>"
echo "example: $0 [email protected]:totten/civix.git 13.10.2"
exit 2
fi
#####################################################
## Make a git tag
pushd "$CALLEDPATH" >> /dev/null
if git tag |grep ^${TAG}\$ -q ; then
echo "Tag $TAG found"
else
git tag $TAG
git push origin $TAG
fi
popd >> /dev/null
#####################################################
## Make a tarball
[ -d "$BUILDDIR" ] && rm -rf "$BUILDDIR"
mkdir -p "$BUILDDIR"
git clone -b "$TAG" "$GITURL" "$BUILDDIR"
pushd "$BUILDDIR" >> /dev/null
composer install
rm -rf .git
find vendor -type d -a -name Test | grep ^vendor/ | while read dir ; do rm -rf "$dir" ; done
find vendor -type d -a -name Tests | grep ^vendor/ | while read dir ; do rm -rf "$dir" ; done
find vendor -type d -a -name tests | grep ^vendor/ | while read dir ; do rm -rf "$dir" ; done
find app/cache app/logs -mindepth 1 -delete
find vendor/swiftmailer/swiftmailer/test-suite -mindepth 1 -delete
find vendor/symfony/symfony/src/Symfony/Component/Locale/Resources/data -mindepth 1 -delete
popd >> /dev/null
pushd $(dirname "$BUILDDIR") >> /dev/null
NAME=$(basename "$BUILDDIR")
TARBALL="$NAME.tar.bz2"
[ -f "$TARBALL" ] && rm -f "$TARBALL"
tar cvjf $TARBALL $NAME
popd >> /dev/null