forked from emaijala/MLInvoice
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpackage.sh
More file actions
executable file
·45 lines (33 loc) · 783 Bytes
/
package.sh
File metadata and controls
executable file
·45 lines (33 loc) · 783 Bytes
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
#!/bin/bash -e
VERSION=$1
BRANCH=${2:-"master"}
echo "Branch $BRANCH"
if [[ ! "$VERSION" ]]; then
echo "Usage: $0 <version> [branch]"
exit 1
fi
ORIGINAL_DIR=$PWD
OUTPUT_FILE=$ORIGINAL_DIR/mlinvoice-$VERSION.zip
MLINVOICE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
TMP_DIR=`mktemp -d`
if [[ ! "$TMP_DIR" || ! -d "$TMP_DIR" ]]; then
echo "Could not create temp dir"
exit 1
fi
function cleanup {
rm -rf "$TMP_DIR"
}
trap cleanup EXIT
cd $MLINVOICE_DIR
git archive --format zip --prefix mlinvoice/ --output $OUTPUT_FILE $BRANCH
cd $TMP_DIR
unzip $OUTPUT_FILE
cd mlinvoice
composer install --no-dev
npm install
grunt uglify sass
rm -rf node_modules
find . -type f -size 0 -delete
cd ..
zip -r $OUTPUT_FILE mlinvoice
echo "$OUTPUT_FILE successfully created"