-
Notifications
You must be signed in to change notification settings - Fork 31
91 lines (87 loc) · 3.91 KB
/
android-build.yml
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
90
91
name: android-build
on: workflow_dispatch
jobs:
build:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '21'
- name: Setup Java JDK
uses: actions/setup-java@v4
with:
java-version: '17.0.10'
distribution: adopt
- name: Setup Android SDK
uses: Swisyn/setup-android-sdk@v1
- name: Setup Android NDK
uses: nttld/setup-ndk@v1
with:
# Exact version to use
ndk-version: r26d
# Add installed NDK to the Android SDK
link-to-sdk: true
- uses: seanmiddleditch/gha-setup-ninja@v4
id: setup-ninja
with:
version: 1.11.1
- name: Setup Rustup Target
run: |
rustup target add aarch64-linux-android armv7-linux-androideabi i686-linux-android x86_64-linux-android
- name: Build child app
run: |
cd gui
yarn install
yarn build:apps
- name: Build ztm
run: |
cd gui
ls /opt/hostedtoolcache/Java_Adopt_jdk/17.0.10-7
export JAVA_HOME='/opt/hostedtoolcache/Java_Adopt_jdk/17.0.10-7/x64'
ls /usr/local/lib/android/sdk
export ANDROID_HOME='/usr/local/lib/android/sdk'
ls -d $ANDROID_HOME/ndk/* | sort -V | tail -n 1 | xargs basename
export NDK="$ANDROID_HOME/ndk/$(ls -d $ANDROID_HOME/ndk/* | sort -V | tail -n 1 | xargs basename)"
yarn build-ztm-android
- name: Build apk
run: |
cd gui
export JAVA_HOME='/opt/hostedtoolcache/Java_Adopt_jdk/17.0.10-7/x64'
export ANDROID_HOME='/usr/local/lib/android/sdk'
export NDK_HOME="$ANDROID_HOME/ndk/$(ls -d $ANDROID_HOME/ndk/* | sort -V | tail -n 1 | xargs basename)"
yarn android-init
cp -f ./src-android/app/src/main/assets/libc++_shared.so ./src-tauri/bin/cli-aarch64-apple-darwin
NODE_OPTIONS="--max-old-space-size=4096" yarn android-build
- name: Align apk
run: |
export JAVA_HOME='/opt/hostedtoolcache/Java_Adopt_jdk/17.0.10-7/x64'
export ANDROID_HOME='/usr/local/lib/android/sdk'
ls $ANDROID_HOME
ls $ANDROID_HOME/build-tools
$ANDROID_HOME/build-tools/31.0.0/zipalign -v 4 ./gui/src-tauri/gen/android/app/build/outputs/apk/universal/release/app-universal-release-unsigned.apk ./gui/src-tauri/gen/android/app/build/outputs/apk/universal/release/app-universal-release-unsigned-aligned.apk
- name: Decode keystore
run: |
echo ${{ secrets.KEYSTORE_BASE64 }} | base64 --decode > ./my-release-key.jks
- name: Sign apk
run: |
export JAVA_HOME='/opt/hostedtoolcache/Java_Adopt_jdk/17.0.10-7/x64'
export ANDROID_HOME='/usr/local/lib/android/sdk'
$ANDROID_HOME/build-tools/31.0.0/apksigner sign --ks ./my-release-key.jks \
--ks-pass env:KEYSTORE_PASSWORD \
--key-pass env:KEY_PASSWORD \
--ks-key-alias "${{ secrets.KEY_ALIAS }}" \
--out ./gui/src-tauri/gen/android/app/build/outputs/apk/universal/release/ztm.apk \
./gui/src-tauri/gen/android/app/build/outputs/apk/universal/release/app-universal-release-unsigned-aligned.apk
env:
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
- name: Verify APK
run: |
export JAVA_HOME='/opt/hostedtoolcache/Java_Adopt_jdk/17.0.10-7/x64'
export ANDROID_HOME='/usr/local/lib/android/sdk'
$ANDROID_HOME/build-tools/31.0.0/apksigner verify ./gui/src-tauri/gen/android/app/build/outputs/apk/universal/release/ztm.apk
- uses: actions/upload-artifact@v3
with:
name: release
path: ./gui/src-tauri/gen/android/app/build/outputs/apk/universal/release/ztm.apk