Skip to content

Commit 9022cc3

Browse files
Set up CI for debug builds and signed releases
1 parent 15b8d29 commit 9022cc3

2 files changed

Lines changed: 92 additions & 0 deletions

File tree

‎.github/workflows/build.yml‎

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
workflow_dispatch:
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout repo
15+
uses: actions/checkout@v4
16+
with:
17+
submodules: true
18+
19+
- name: Set up Android NDK
20+
uses: nttld/setup-ndk@v1
21+
with:
22+
ndk-version: r28b
23+
24+
- name: Build proot
25+
run: |
26+
thirdparty/proot/build.sh
27+
28+
- name: Set up JDK
29+
uses: actions/setup-java@v4
30+
with:
31+
java-version: 17
32+
distribution: temurin
33+
34+
- name: Build debug APK
35+
run: |
36+
./gradlew assembleDebug
37+
38+
- name: Decode keystore
39+
run: |
40+
echo "${{ secrets.KEYSTORE }}" | base64 -d > /tmp/release.keystore
41+
42+
- name: Build release APK
43+
if: github.ref == 'refs/heads/main'
44+
env:
45+
GABE_RELEASE_KEYSTORE_FILE: /tmp/release.keystore
46+
GABE_RELEASE_SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}
47+
GABE_RELEASE_KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
48+
GABE_RELEASE_KEY_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}
49+
run: |
50+
./gradlew assembleRelease
51+
52+
- name: Build release AAB
53+
if: github.ref == 'refs/heads/main'
54+
env:
55+
GABE_RELEASE_KEYSTORE_FILE: /tmp/release.keystore
56+
GABE_RELEASE_SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}
57+
GABE_RELEASE_KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
58+
GABE_RELEASE_KEY_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}
59+
run: |
60+
./gradlew bundleRelease
61+
62+
- name: Upload debug artifacts
63+
uses: actions/upload-artifact@v4
64+
with:
65+
name: debug-artifacts
66+
path: |
67+
app/build/outputs/apk/debug/
68+
69+
- name: Upload release artifacts
70+
if: github.ref == 'refs/heads/main'
71+
uses: actions/upload-artifact@v4
72+
with:
73+
name: release-artifacts
74+
path: |
75+
app/build/outputs/apk/release/
76+
app/build/outputs/bundle/release/

‎app/build.gradle‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ android {
1010
compileSdk = 35
1111
ndkVersion = '28.1.13356709'
1212

13+
def keystoreFile = System.getenv("GABE_RELEASE_KEYSTORE_FILE")
14+
1315
sourceSets {
1416
main {
1517
jniLibs.srcDirs += [
@@ -28,8 +30,22 @@ android {
2830
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
2931
}
3032

33+
if (keystoreFile != null) {
34+
signingConfigs {
35+
release {
36+
storeFile file(System.getenv("GABE_RELEASE_KEYSTORE_FILE"))
37+
storePassword System.getenv("GABE_RELEASE_SIGNING_PASSWORD")
38+
keyAlias System.getenv("GABE_RELEASE_KEY_ALIAS")
39+
keyPassword System.getenv("GABE_RELEASE_KEY_PASSWORD")
40+
}
41+
}
42+
}
43+
3144
buildTypes {
3245
release {
46+
if (keystoreFile != null) {
47+
signingConfig signingConfigs.release
48+
}
3349
minifyEnabled false
3450
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
3551
}

0 commit comments

Comments
 (0)