forked from LockerProject/Locker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mktarball.sh
executable file
·43 lines (34 loc) · 883 Bytes
/
mktarball.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
#!/bin/bash
set -e
rev=$(git rev-parse --short --default HEAD $rev)
build_id=${BUILD_NUMBER:-$rev}
subdir="locker-$build_id"
top="$PWD"
out="$PWD/locker-$build_id.tar.gz"
builddir="$top/build"
rm -rf "$builddir"
mkdir -p "$builddir/$subdir"
trap "rm -rf \"$builddir\"" EXIT
# fetch a clean copy of the code from git
echo "Fetching code..."
git archive $rev | tar -x -C "$builddir/$subdir"
if test -d "$top/node_modules"; then
cp -a "$top/node_modules" "$builddir/$subdir"
else
echo "Building..."
cd "$builddir/$subdir"
npm install
fi
mkdir -p "$builddir/$subdir/Me"
echo "Compressing..."
(cd "$builddir"; tar czf "$out" "$subdir")
# The test suite doesn't clean up after itself, so do this last
#echo "Testing..."
#cd "$builddir/$subdir/tests"
#if ! node runTests.js; then
# echo "Tests failed!"
# rm -f "$out"
# exit 1
#fi
echo "Done."
echo "$out"