forked from ushahidi/platform
-
Notifications
You must be signed in to change notification settings - Fork 0
/
release.sh
executable file
·55 lines (43 loc) · 1.08 KB
/
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
50
51
52
53
54
55
#!/bin/bash
# if someone invokes this with bash
set -e
# build release tarball
usage() {
echo usage: $0 VERSION
exit 2
}
test $# -eq 1 || usage
VERSION=$1
CWD=$(pwd)
# Install composer dependencies (with autoload file generation enabled)
composer install --no-scripts;
TMP_DIR=$(mktemp -d 2>/dev/null || mktemp -d -t platform-build)
WORK_DIR=$TMP_DIR/ushahidi-platform-bundle-${VERSION}
mkdir $WORK_DIR
if [ -z "$DEST_DIR" ]; then
DEST_DIR="${CWD}/build"
fi
echo "Copy to temp dir"
cp -R ./ $WORK_DIR
# Tar it up.
echo "Building tarball"
if [ ! -d "$DEST_DIR" ]; then
mkdir -p "$DEST_DIR"
fi
TARFILE="${DEST_DIR}/ushahidi-platform-bundle-${VERSION}.tar"
tar -C $TMP_DIR -cf $TARFILE \
--exclude 'build' \
--exclude 'docs' \
--exclude 'storage/logs/*' \
--exclude '.travis.yml' \
--exclude '.vagrant' \
--exclude 'tmp' \
--exclude '.env' \
--exclude '.env.travis' \
--exclude '.git' \
--exclude '.gitbook' \
ushahidi-platform-bundle-${VERSION}/
gzip -f $TARFILE
echo "Release tarball: ${TARFILE}.gz"
ls -la ${TARFILE}.gz
rm -rf $TMP_DIR