-
Notifications
You must be signed in to change notification settings - Fork 3
89 lines (77 loc) · 2.51 KB
/
Android.yml
File metadata and controls
89 lines (77 loc) · 2.51 KB
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
name: Android Build
on:
push:
branches:
- dev
- main
paths-ignore:
- '*.md'
- 'Documents/**'
pull_request:
types: [opened, synchronize]
paths-ignore:
- '*.md'
- 'Documents/**'
release:
types: [published]
paths-ignore:
- '*.md'
- 'Documents/**'
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build-android:
runs-on: macos-15
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
cache: gradle
- name: Install NDK 23.2.8568313
run: |
yes | $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --install "ndk;23.2.8568313"
- name: Cache SDL2
id: cache-sdl2
uses: actions/cache@v4
with:
path: |
Builder/Android/app/jni/SDL
Builder/Android/app/src/main/java/org/libsdl
key: ${{ runner.os }}-android-sdl2-${{ hashFiles('Builder/Android/setup_sdl2.sh') }}
restore-keys: |
${{ runner.os }}-android-sdl2-
- name: Setup SDL2
if: steps.cache-sdl2.outputs.cache-hit != 'true'
working-directory: Builder/Android
run: ./setup_sdl2.sh
- name: Build with Gradle
working-directory: Builder/Android
run: |
if [[ -n "${{ secrets.KEYSTORE_BASE64 }}" ]]; then
echo "${{ secrets.KEYSTORE_BASE64 }}" | base64 -d > release.keystore
export KEYSTORE_PASSWORD="${{ secrets.KEYSTORE_PASSWORD }}"
export KEY_ALIAS="${{ secrets.KEY_ALIAS }}"
export KEY_PASSWORD="${{ secrets.KEY_PASSWORD }}"
fi
./gradlew assembleRelease
- name: Rename APK to XM8_Android.apk
run: |
APK_PATH=$(ls Builder/Android/app/build/outputs/apk/release/*.apk | head -n 1)
mv "$APK_PATH" Builder/Android/app/build/outputs/apk/release/XM8_Android.apk
- name: Upload APKs
uses: actions/upload-artifact@v4
with:
name: XM8_Android.apk
path: Builder/Android/app/build/outputs/apk/release/XM8_Android.apk
- name: Update Release
if: ${{ github.event_name == 'release' && !env.ACT }}
uses: svenstaro/upload-release-action@v2
with:
file: Builder/Android/app/build/outputs/apk/release/XM8_Android.apk
overwrite: true