forked from 10bits/gedoor-Build
-
Notifications
You must be signed in to change notification settings - Fork 0
/
action_app_custom.sh
80 lines (79 loc) · 2.82 KB
/
action_app_custom.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
#!/bin/sh
#本脚本用来个性化定制app,不会修改任何程序代码
function app_clear_18plus()
{
if [ $APP_NAME = 'legado' ]; then
echo "清空18PlusList.txt"
echo "">$APP_WORKSPACE/app/src/main/assets/18PlusList.txt
fi
}
function app_color_set()
{
if [ $APP_NAME = 'legado' ]; then
#设置搜索界面浮动按钮颜色
sed '/id\/fb_stop/a\ android:backgroundTint="#389099"' $APP_WORKSPACE/app/src/main/res/layout/activity_book_search.xml -i
fi
}
function app_resources_unuse()
{
if [ $APP_NAME = 'legado' ]; then
echo "删除一些用不到的资源"
rm $APP_WORKSPACE/app/src/main/assets/bg -rf
rm $APP_WORKSPACE/app/src/main/assets/web/new -rf
fi
}
function app_minify()
{
#缩小apk体积
sed '/minifyEnabled/i\ shrinkResources true' $APP_WORKSPACE/app/build.gradle -i
sed 's/minifyEnabled false/minifyEnabled true/' $APP_WORKSPACE/app/build.gradle -i
}
function app_live_together()
{
if [ $APP_NAME = 'legado' ]; then
echo "解决安装程序共存问题"
sed "s/'.release'/'.releaseA'/" $APP_WORKSPACE/app/build.gradle -i
sed 's/.release/.releaseA/' $APP_WORKSPACE/app/google-services.json -i
fi
}
function app_sign()
{
echo "给apk增加签名"
cp $GITHUB_WORKSPACE/.github/workflows/legado.jks $APP_WORKSPACE/app/legado.jks
sed '$a\RELEASE_STORE_FILE=./legado.jks' $APP_WORKSPACE/gradle.properties -i
sed '$a\RELEASE_KEY_ALIAS=legado' $APP_WORKSPACE/gradle.properties -i
sed '$a\RELEASE_STORE_PASSWORD=gedoor_legado' $APP_WORKSPACE/gradle.properties -i
sed '$a\RELEASE_KEY_PASSWORD=gedoor_legado' $APP_WORKSPACE/gradle.properties -i
}
function app_not_apply_plugin()
{
if [ $APP_NAME = 'MyBookshelf' ]; then
echo "删除google services相关"
sed '/io.fabric/d' $APP_WORKSPACE/app/build.gradle -i
sed '/com.google.firebase/d' $APP_WORKSPACE/app/build.gradle -i
sed '/com.google.gms/d' $APP_WORKSPACE/app/build.gradle -i
fi
}
function app_other()
{
if [ $APP_NAME = 'MyBookshelf' ]; then
echo "$APP_NAME 解压MyBookshelf_Keys.zip"
unzip -o $APP_WORKSPACE/app/MyBookshelf_Keys.zip -d $APP_WORKSPACE/app
rm $APP_WORKSPACE/app/gradle.properties
#sed 's/com.gedoor.monkeybook/com.kunfei.bookshelf/' $APP_WORKSPACE/app/build.gradle -i
fi
}
function app_build()
{
echo "build with gradle"
cd $APP_WORKSPACE
chmod +x gradlew
./gradlew aR
if [ $APP_NAME = 'MyBookshelf' ]; then
echo ::set-env name=APP_UPLOAD::$APP_WORKSPACE/app/build/outputs/apk/release
fi
}
if [ $SECRETS_MINIFY = 'true' ]; then
app_minify;app_resources_unuse
fi
app_clear_18plus;app_sign;app_live_together;app_not_apply_plugin;app_build