Skip to content

Commit 3215a2a

Browse files
authored
Add CI and release .apk signing (#18)
1 parent dc677e4 commit 3215a2a

File tree

3 files changed

+103
-1
lines changed

3 files changed

+103
-1
lines changed

.github/workflows/ci.yml

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
name: CI
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, reopened, ready_for_review]
6+
push:
7+
branches:
8+
- master
9+
10+
jobs:
11+
12+
#----------------------------------------------------------------------------
13+
# Cache LFS: Checkout LFS data and update the cache to limit LFS bandwidth
14+
#----------------------------------------------------------------------------
15+
cache_lfs:
16+
runs-on: ubuntu-22.04
17+
name: Update LFS data cache
18+
outputs:
19+
lfs_sha: ${{ steps.lfs_sha_recover.outputs.lfs_sha }}
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v4
23+
with:
24+
path: "source"
25+
fetch-depth: 1
26+
lfs: false
27+
28+
- name: Cache LFS Data
29+
id: lfs_sha_recover
30+
uses: f3d-app/lfs-data-cache-action@v2
31+
with:
32+
cache_postfix: cache-0
33+
34+
build:
35+
needs: [cache_lfs]
36+
37+
name: Build APKs
38+
runs-on: ubuntu-latest
39+
40+
env:
41+
ANDROID_KEYSTORE_BASE64: ${{ secrets.ANDROID_KEYSTORE_BASE64 }}
42+
ANDROID_KEYSTORE_PASSWORD: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }}
43+
CMAKE_BUILD_PARALLEL_LEVEL: 4
44+
45+
steps:
46+
- name: Checkout
47+
uses: actions/checkout@v4
48+
with:
49+
path: "source"
50+
fetch-depth: 0
51+
lfs: false
52+
53+
- name: Recover LFS Data
54+
uses: f3d-app/lfs-data-cache-action@v2
55+
with:
56+
type: "consumer"
57+
lfs_sha: ${{ needs.cache_lfs.outputs.lfs_sha }}
58+
cache_postfix: cache-0
59+
60+
- name: Decode keystore
61+
run: echo "$ANDROID_KEYSTORE_BASE64" | base64 -d > source/f3d/f3d-android-key.jks
62+
63+
- name: Set up JDK 17
64+
uses: actions/setup-java@v4
65+
with:
66+
java-version: '17'
67+
distribution: 'temurin'
68+
69+
- name: Setup Gradle
70+
uses: gradle/actions/setup-gradle@v4
71+
72+
- name: Build APKs
73+
run: ./gradlew assembleRelease
74+
75+
- name: Upload APKs
76+
uses: actions/upload-artifact@v4
77+
with:
78+
name: apk-release
79+
path: f3d/build/outputs/apk/release/*.apk

f3d/.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
1-
/build
1+
# Build artifacts
2+
/build
3+
4+
# Android signing file (should be kept private)
5+
*.jks

f3d/build.gradle

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,28 @@ android {
1313
versionName "1.0"
1414
}
1515

16+
splits {
17+
abi {
18+
enable true
19+
reset()
20+
include "arm64-v8a", "armeabi-v7a", "x86_64", "x86"
21+
universalApk false
22+
}
23+
}
24+
25+
signingConfigs {
26+
release {
27+
storeFile file("f3d-android-key.jks")
28+
storePassword System.getenv("ANDROID_KEYSTORE_PASSWORD")
29+
keyAlias "release"
30+
keyPassword System.getenv("ANDROID_KEYSTORE_PASSWORD")
31+
}
32+
}
33+
1634
buildTypes {
1735
release {
1836
minifyEnabled false
37+
signingConfig signingConfigs.release
1938
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
2039
}
2140
}

0 commit comments

Comments
 (0)