forked from ruffle-rs/ruffle-android
-
Notifications
You must be signed in to change notification settings - Fork 0
112 lines (88 loc) · 3.09 KB
/
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
name: Build
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
jobs:
build-native-libs:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- android-abi: arm64-v8a
rust-target: aarch64-linux-android
- android-abi: armeabi-v7a
rust-target: armv7-linux-androideabi
- android-abi: x86_64
rust-target: x86_64-linux-android
- android-abi: x86
rust-target: i686-linux-android
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
targets: ${{ matrix.rust-target }}
- name: Cache Cargo output
uses: Swatinem/rust-cache@v2
with:
shared-key: ${{ matrix.rust-target }}
save-if: ${{ github.ref == 'refs/heads/main' }}
- name: Install cargo-ndk
run: cargo install cargo-ndk
- name: Build native libs
run: |
unset ANDROID_SDK_ROOT # Deprecated, will cause an error if left set.
cargo ndk --target ${{ matrix.android-abi }} --platform 26 -o jniLibs build --release
- uses: actions/upload-artifact@v4
with:
name: native-lib-${{ matrix.android-abi }}
path: jniLibs
build-apks:
needs: build-native-libs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with: # no name set, so all artifacts are downloaded
path: native-libs
- name: Copy native libs
run: |
mkdir app/src/main/jniLibs
cp -r native-libs/*/* app/src/main/jniLibs/
- name: Set up Java 17
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
- name: Build debug APK
# The native libs are always built in release mode, this is left in here just so if
# something with the signing procedure below goes haywire, we still have something.
run: ./gradlew assembleDebug # The release version doesn't work without signing
- uses: actions/upload-artifact@v4
with:
name: ruffle-debug-apks
path: app/build/outputs/apk/debug/*.apk
- name: Decode keystore
if: ${{ !github.event.pull_request.head.repo.fork }}
env:
ENCODED_STRING: ${{ secrets.KEYSTORE }}
run: |
echo $ENCODED_STRING | base64 -di > app/androidkey.jks
- name: Build release APK
if: ${{ !github.event.pull_request.head.repo.fork }}
run: ./gradlew assembleRelease
env:
SIGNING_KEY_ALIAS: ${{ secrets.SIGNING_KEY_ALIAS }}
SIGNING_KEY_PASSWORD: ${{ secrets.SIGNING_KEY_PASSWORD }}
SIGNING_STORE_PASSWORD: ${{ secrets.SIGNING_STORE_PASSWORD }}
- uses: actions/upload-artifact@v4
if: ${{ !github.event.pull_request.head.repo.fork }}
with:
name: ruffle-release-apks
path: app/build/outputs/apk/release/*.apk