forked from arnoudkooi/ServiceNow-Utils
-
Notifications
You must be signed in to change notification settings - Fork 0
/
publish.sh
executable file
·57 lines (50 loc) · 2.9 KB
/
publish.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
#!/bin/bash
rm -f publish/*.zip
rm -f publish/*.xpi
var=$(sed '6!d' manifest.json) #get version from main manifest.json (content of line 6)
sed -i '' "6s/.*/$var/" publish/manifest-firefox.json #sync version to other
sed -i '' "6s/.*/$var/" publish/manifest-onprem.json
sed -i '' "6s/.*/$var/" publish/manifest-firefox-onprem.json
sed -i '' "6s/.*/$var/" publish/manifest-edge.json
zip -r publish/chrome-snutils.zip . -x "*.DS_Store" -x "*.git*" -x ".jshintrc" -x ".docx" -x "*.sh" -x "*.md" -x "*publish*"
mv manifest.json publish/manifest-chrome.json
mv publish/manifest-firefox.json manifest.json
mv js/monaco/vs/language/typescript/tsWorker.js publish/tsWorker.js
mv publish/tsWorkerFF.js js/monaco/vs/language/typescript/tsWorker.js
zip -r publish/firefox-snutils.xpi . -x "*.DS_Store" -x "*.git*" -x ".jshintrc" -x ".docx" -x "*.sh" -x "*.md" -x "*publish*"
echo "1th"
mv js/monaco/vs/language/typescript/tsWorker.js publish/tsWorkerFF.js
mv publish/tsWorker.js js/monaco/vs/language/typescript/tsWorker.js
mv manifest.json publish/manifest-firefox.json
mv publish/manifest-edge.json manifest.json
zip -r publish/edge-snutils.zip . -x "*.DS_Store" -x "*.git*" -x ".jshintrc" -x ".docx" -x "*.sh" -x "*.md" -x "*publish*"
mv manifest.json publish/manifest-edge.json
sed -i '' "1s/.*/var onprem = true;/" background.js
mv publish/manifest-onprem.json manifest.json
zip -r publish/onprem-snutils.zip . -x "*.DS_Store" -x "*.git*" -x ".jshintrc" -x ".docx" -x "*.sh" -x "*.md" -x "*publish*"
mv manifest.json publish/manifest-onprem.json
mv publish/manifest-firefox-onprem.json manifest.json
mv js/monaco/vs/language/typescript/tsWorker.js publish/tsWorker.js
mv publish/tsWorkerFF.js js/monaco/vs/language/typescript/tsWorker.js
zip -r publish/onprem-firefox-snutils.xpi . -x "*.DS_Store" -x "*.git*" -x ".jshintrc" -x ".docx" -x "*.sh" -x "*.md" -x "*publish*"
echo "2nd"
mv js/monaco/vs/language/typescript/tsWorker.js publish/tsWorkerFF.js
mv publish/tsWorker.js js/monaco/vs/language/typescript/tsWorker.js
mv manifest.json publish/manifest-firefox-onprem.json
mv publish/manifest-chrome.json manifest.json
sed -i '' "1s/.*/var onprem = false;/" background.js
var=' "version": "0.0.0.0",'
sed -i '' "6s/.*/$var/" publish/manifest-firefox.json #sync version to other
sed -i '' "6s/.*/$var/" publish/manifest-onprem.json
sed -i '' "6s/.*/$var/" publish/manifest-firefox-onprem.json
sed -i '' "6s/.*/$var/" publish/manifest-edge.json
#publishing same version# to Chrome is a pain, adding a check..
currentversion=$(sed '6!d' manifest.json) #get version from main manifest.json (content of line 6)
lastpublishedversion=`cat publish/lastpublishedversion.txt`
if [ "$lastpublishedversion" = "$currentversion" ]; then
echo "Can not publish, version not updated in manifest.json: $currentversion"
else
node publish/publish.mjs
echo "Publishing: $currentversion"
echo "$currentversion" > publish/lastpublishedversion.txt #write version to file
fi