-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathandroid.sh
42 lines (37 loc) · 1.08 KB
/
android.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
if [ -z "$1" ]
then
echo "No argument supplied"
exit
fi
node node_modules/vite/bin/vite.js build --mode android
rm -rf ./bundle
mkdir bundle
npx cap add android
npx cap copy android
rm -rf ../dist
npx capacitor-assets generate --android
# Set build number
build=$(cat buildnumber)
newbuild=$(($build+1))
node_modules/capacitor-set-version/bin/run set:android -v $1 -b $newbuild
cd android
# To enable persistent cookies
echo "package com.wwwallet.app;
import android.webkit.CookieManager;
import com.getcapacitor.BridgeActivity;
public class MainActivity extends BridgeActivity {
@Override
public void onPause() {
super.onPause();
CookieManager.getInstance().flush();
}
}" > ./app/src/main/java/com/wwwallet/app/MainActivity.java
./gradlew bundleRelease
mv app/build/outputs/bundle/release/app-release.aab ../bundle/wwwallet-unsigned.aab
cd ..
rm -rf ./android
# Sign bundle
cd bundle
jarsigner -sigalg SHA256withRSA -digestalg SHA-256 -keystore ~/keys/wwwallet.jks -signedjar wwwallet.aab wwwallet-unsigned.aab wwwallet
rm wwwallet-unsigned.aab
echo $newbuild > ../buildnumber