forked from justjavac/ReplaceGoogleCDN
-
Notifications
You must be signed in to change notification settings - Fork 0
/
release-archive-v3.sh
89 lines (57 loc) · 2.25 KB
/
release-archive-v3.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
79
80
81
82
83
84
85
86
87
88
89
#!/bin/bash
set -exu
__DIR__=$(
cd "$(dirname "$0")"
pwd
)
cd ${__DIR__}
mkdir -p ${__DIR__}/var/
mkdir -p ${__DIR__}/dist/
## 打包 chromium 扩展
test -f ${__DIR__}/dist/ReplaceGoogleCDN-v3-chromium.zip && rm -f ${__DIR__}/dist/ReplaceGoogleCDN-v3-chromium.zip
cd ${__DIR__}/
test -d ${__DIR__}/extension/_metadata && rm -rf ${__DIR__}/extension/_metadata
cd ${__DIR__}/extension
# 打包 manifest v3 支持chromium 内核系列
zip -r ${__DIR__}/dist/ReplaceGoogleCDN-v3-chromium.zip . \
-x ".git/*" \
-x ".idea/*" \
-x "_metadata/*" \
-x "node_modules/*" \
-x "tools/*" \
-x "_metadata/*" \
-x "rules/example-advance/*" \
-x "rules/example/*" \
-x "background-page.html" \
-x "screenshot/*" \
-x "test/*" \
-x "web/*" \
-x "web-backup/*" \
-x "manifest-backup.json" \
-x "third_party/highlightjs/*" \
-x "third_party/webrtc/*"
cd ${__DIR__}/
zip -u ${__DIR__}/dist/ReplaceGoogleCDN-v3-chromium.zip ./README.md
zip -u ${__DIR__}/dist/ReplaceGoogleCDN-v3-chromium.zip ./Privacy.md
zip -u ${__DIR__}/dist/ReplaceGoogleCDN-v3-chromium.zip ./LICENSE
## 打包 firefox 扩展
test -f ${__DIR__}/dist/ReplaceGoogleCDN-v3-firefox.zip && rm -f ${__DIR__}/dist/ReplaceGoogleCDN-v3-firefox.zip
mkdir -p ${__DIR__}/var/extension-tmp/rules/
cp -rf ${__DIR__}/extension/rules/*.json ${__DIR__}/var/extension-tmp/rules/
cp -rf ${__DIR__}/extension/icons ${__DIR__}/var/extension-tmp/
rm -f ${__DIR__}/var/extension-tmp/rules/rules_remove_content_security_policy_header_test.json
rm -f ${__DIR__}/var/extension-tmp/rules/rules-default-domains-helper.json
python3 tools/update-v3-manifest.py firefox
cd ${__DIR__}/var/extension-tmp/
zip -r ${__DIR__}/dist/ReplaceGoogleCDN-v3-firefox.zip .
cd ${__DIR__}/
zip -u ${__DIR__}/dist/ReplaceGoogleCDN-v3-firefox.zip ./README.md
zip -u ${__DIR__}/dist/ReplaceGoogleCDN-v3-firefox.zip ./Privacy.md
zip -u ${__DIR__}/dist/ReplaceGoogleCDN-v3-firefox.zip ./LICENSE
# 查看打包结果
cd ${__DIR__}/dist
test -d ReplaceGoogleCDN-v3-chromium && rm -rf ReplaceGoogleCDN-v3-chromium
test -d ReplaceGoogleCDN-v3-firefox && rm -rf ReplaceGoogleCDN-v3-firefox
unzip ReplaceGoogleCDN-v3-chromium.zip -d ReplaceGoogleCDN-v3-chromium
unzip ReplaceGoogleCDN-v3-firefox.zip -d ReplaceGoogleCDN-v3-firefox
cd ${__DIR__}