-
Notifications
You must be signed in to change notification settings - Fork 2
/
build-and-package.sh
executable file
·74 lines (63 loc) · 1.2 KB
/
build-and-package.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/bin/bash
set -e
usage() {
cat <<EOT
Usage: $0 [-h|--help] --key=<KEY>|-k <KEY>
Arguments
-h, --help Show help
-k KEYFILE, --key=KEYFILE Extension private key file
EOT
}
keyfile=""
while [[ $# > 0 ]]
do
case "$1" in
-k)
keyfile=$2
shift 2
;;
--key=*)
keyfile=${1#*=}
shift
;;
-h|--help)
usage
exit 0
;;
*)
args=("${args[@]}" "$1")
shift
;;
esac
done
set -u
# Check required params
[[ -z "$keyfile" ]] && {
usage
exit 1
}
# Some sanity checks
[[ ! -f $keyfile ]] && {
echo "Keyfile $keyfile does not exist!"
exit 1
}
# Ensure that npm packages are installed
echo "Installing packages ..."
npm install
# Ensure that bower_components are installed
echo "Installing bower components ..."
node_modules/.bin/bower install
# Do the build
echo "Building duke2.zip ..."
# Create a temp dir, copy stuff there and compress the extension
echo "Copying files"
build_dir=$(mktemp -d)
cp -R app/. $build_dir
cp $keyfile $build_dir/key.pem
echo "Compressing extension and $keyfile into duke2.zip"
cd $build_dir
zip -r duke2.zip .
cd -
cp $build_dir/duke2.zip .
echo "Done building duke2.zip"
echo "Go to Chrome webstore and upload duke2.zip"