-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathrelease.sh
executable file
·49 lines (40 loc) · 1.03 KB
/
release.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
#!/bin/bash
npm run build-prod
REL="releases/"
NOTES_VER=$(jq -r .[0].version resources/update-log.json) # update log version
MAN_VER=$(jq -r .version manifest.json) # manifest version
ZIP="$REL$MAN_VER.zip"
if [ ! -d "$REL" ]; then # release folder check
mkdir $REL
fi
check_overwrite () {
printf "$1"
read -r response
if [ $response == "y" ]; then
return 0
else
return 1
fi
}
if [ $NOTES_VER != $MAN_VER ]; then # mismatched version check
check_overwrite "Manifest and update log version numbers are mismatched, are they incremented?\nYou can overwrite [y] "
if [ $? != 0 ]; then
exit 1
fi
fi
if [ $1 ]; then
if [ $1 == "--source" ]; then
git archive -o "$REL$MAN_VER.src.zip" HEAD
echo "Source code zipped!"
exit 0
fi
fi
if [ -f $ZIP ]; then # overwrite check
check_overwrite "$MAN_VER.zip already exists, have you incremented the version?\nYou can overwrite [y] "
if [ $? != 0 ]; then
exit 1
fi
rm $ZIP
fi
zip -r $ZIP dist popup styles images manifest.json -q # zip it all up
echo "Zipped! $MAN_VER is now ready."