forked from topmonks/hlidac-shopu
-
Notifications
You must be signed in to change notification settings - Fork 0
/
version.sh
executable file
·51 lines (39 loc) · 1.33 KB
/
version.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
#!/bin/bash
package_json_ver=$(jq -r '.version' package.json)
manifest_ver=$(jq -r '.version' extension/manifest.json)
about_ver=$(perl -n -e'/<small>(\d+\.\d+\.\d+)<\/small>/ && print $1' < extension/popup/about.html)
if [ "$PRINT" = "manifest" ]; then
echo "$manifest_ver";
else
echo "package.json $package_json_ver"
echo "manifest.json $manifest_ver"
echo "about.html $about_ver"
fi
if [ "$FORCE" != "1" ]; then
if [ "$package_json_ver" != "$manifest_ver" ] || [ "$manifest_ver" != "$about_ver" ]; then
echo "version mismatch; pls fix"
exit 1
fi
fi
new_ver=$1
if [ ! -e $new_ver ]; then
echo
echo "updating to $new_ver"
tmp=$(mktemp)
jq ".version = \"$new_ver\"" package.json > $tmp
mv $tmp package.json
tmp=$(mktemp)
jq ".version = \"$new_ver\"" extension/package.json > $tmp
mv $tmp extension/package.json
tmp=$(mktemp)
jq ".version = \"$new_ver\"" extension/manifest.json > $tmp
mv $tmp extension/manifest.json
tmp=$(mktemp)
jq ".version = \"$new_ver\"" www.hlidacshopu.cz/src/static/webapp.json > $tmp
mv $tmp www.hlidacshopu.cz/src/static/webapp.json
tmp=$(mktemp)
sed -E "s/<small>[0-9]+\.[0-9]+\.[0-9]+<\/small>/<small>$new_ver<\/small>/" extension/popup/about.html > $tmp
mv $tmp extension/popup/about.html
exec "node" "scripts/set-apple-version.js"
echo "Version updated to $new_ver"
fi