-
Notifications
You must be signed in to change notification settings - Fork 35
/
amobuilder.sh
executable file
·78 lines (61 loc) · 1.52 KB
/
amobuilder.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
75
76
77
78
#! /bin/bash
# in order to comply with AMO policies we need to offer a way
# to reproduce the exact build from the original source code
#
# https://extensionworkshop.com/documentation/publish/source-code-submission/
#
# Usage:
# bash amobuilder.sh cliqz
# bash amobuilder.sh sparalarm
# bash amobuilder.sh myoffrz
#
set -e
usage () {
echo
echo "Usage: bash $0 product"
echo "* product one of |cliqz|, |sparalarm|, |myoffrz| or |gt|"
echo
echo "eg: bash amobuilder.sh cliqz"
}
if [ $# -eq 0 ]; then
usage
exit 1
fi
case "$1" in
cliqz)
CONFIG="amo-webextension.js"
;;
sparalarm)
CONFIG="offers-chip-firefox.js"
;;
myoffrz)
CONFIG="offers-firefox.js"
;;
gt)
CONFIG="ghostery-tab-firefox.js"
;;
*)
usage
exit 1
esac
echo "start building CONFIG=$CONFIG"
# clean any previous builds
rm -fr build
# clean all the exiting node_modules for a more reproducible build
rm -fr node_modules
# install the exact versions from package-lock.json
npm ci
# build a production version for the extension specified in $CONFIG
./fern.js build configs/releases/$CONFIG --no-debug --environment=production
cd build
RAW_VERSION=`cat manifest.json | jq '.version'`
EXTENSION_ID=`cat manifest.json | jq -r '.applications.gecko.id'`
VERSION=${RAW_VERSION//\"}
EXPECTED_FILENAME="$EXTENSION_ID.$VERSION.xpi"
zip --exclude=*.DS_Store* ../$EXPECTED_FILENAME -r *
cd ..
echo
echo
echo
echo "$EXTENSION_ID xpi ready"
echo "Path: `pwd $EXPECTED_FILENAME`/$EXPECTED_FILENAME"