-
Notifications
You must be signed in to change notification settings - Fork 24
Expand file tree
/
Copy pathpackage.sh
More file actions
executable file
·47 lines (36 loc) · 1003 Bytes
/
package.sh
File metadata and controls
executable file
·47 lines (36 loc) · 1003 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
46
47
#!/bin/bash -e
VERSION=$1
BRANCH=${2:-"dev"}
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
git log v1.10.0..$BRANCH --diff-filter=D --summary | grep 'delete mode' | cut -d " " -f 5- > $TMP_DIR/obsolete_files.txt
cd $TMP_DIR
unzip $OUTPUT_FILE
mv obsolete_files.txt mlinvoice/
cd mlinvoice
composer install --no-dev
npm install
grunt uglify sass
# Make sure to keep node_modules/.htaccess:
rm -rf node_modules/*
npm install --production
find . -type f -size 0 -delete
cd ..
zip -r $OUTPUT_FILE mlinvoice
echo "$OUTPUT_FILE successfully created from branch $BRANCH"