-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathverify.sh
executable file
·60 lines (43 loc) · 1.34 KB
/
verify.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
#!/usr/bin/env bash
set -e
USAGE='\
usage: ./verify.sh <path-to-xpi-file> <version>"
e.g.:
./verify.sh "$HOME/Library/Application Support/Firefox/Profiles/foo-bar-baz.dev-edition-default/extensions/[email protected]" 0.8.2
'
if test $# -lt 2; then
>&2 echo "$USAGE"
exit 1
fi
# in macos:
# $HOME/Library/Application Support/Firefox/Profiles/<YOUR_PROFILE>/extensions/[email protected]
XPI_TO_VERIFY="$1"
shift
VERSION="$1"
shift
if ! test -f "$XPI_TO_VERIFY"; then
>&2 echo "provided xpi file not found."
exit 1
fi
OUTDIR="verify/$VERSION"
rm -rf "$OUTDIR" # clean
mkdir -p "$OUTDIR"
ORIG_XPI="$OUTDIR/uploaded.xpi"
VERIFY_OUT="$OUTDIR/uploaded"
cp "$XPI_TO_VERIFY" "$ORIG_XPI"
unzip "$ORIG_XPI" -d "$VERIFY_OUT"
git checkout "v$VERSION"
yarn install --check-files --frozen-lockfile
bash ./build-distribution.sh
bash ./build-web-ext-artifacts.sh "$VERSION"
BUILT_XPI="$OUTDIR/built.zip"
BUILT_OUT="$OUTDIR/built"
mv "web-ext-artifacts/refined_gitlab-$VERSION.zip" "$BUILT_XPI"
mv "web-ext-artifacts/refined_gitlab-source.zip" "$OUTDIR/source.zip"
rm -rf web-ext-artifacts
unzip "$BUILT_XPI" -d "$BUILT_OUT"
DIFF_OUT="$OUTDIR/built-vs-uploaded.diff"
diff -u -r "$VERIFY_OUT" "$BUILT_OUT" > "$DIFF_OUT" || :
printf "\n\n\nverify.sh: created %s\n\n" "$DIFF_OUT"
git checkout - 2>/dev/null
test -n "$VERBOSE" && cat "$DIFF_OUT"