Skip to content

Commit 12b488f

Browse files
authored
Merge branch 'develop' into feature/po-editor-script
2 parents ad95a47 + a38d802 commit 12b488f

19 files changed

Lines changed: 140 additions & 441 deletions

File tree

.github/workflows/_prepare-all.yml

Lines changed: 0 additions & 19 deletions
This file was deleted.

.github/workflows/_prepare-release.yml

Lines changed: 0 additions & 16 deletions
This file was deleted.

.github/workflows/debug.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@ name: Debug Builds
22

33
on: [ push ] # run on all pushes on any branch
44

5+
# Cancel any in-progress runs of this workflow if a new run is triggered within the same branch or PR
6+
concurrency:
7+
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
8+
cancel-in-progress: true
9+
510
jobs:
611
build:
712
runs-on: macos-latest # use [ self-hosted, macOS ] to host on our own mac mini, which is twice as fast and cheaper than hosting on a github runner. See README for more info.

.github/workflows/firebase-app-distribution.yml

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ on:
55
pull_request:
66
branches: [ 'develop' ]
77

8+
# Cancel any in-progress runs of this workflow if a new run is triggered within the same branch or PR
9+
concurrency:
10+
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
11+
cancel-in-progress: true
12+
813
jobs:
914
build:
1015
runs-on: macos-latest # use [ self-hosted, macOS ] to host on our own mac mini, which is twice as fast and cheaper than hosting on a github runner. See README for more info.
@@ -22,12 +27,13 @@ jobs:
2227
run: |
2328
echo $ENCODED_STRING > keystore-b64.txt
2429
base64 -d <keystore-b64.txt >upload-keystore.jks
30+
# The secrets.gradle file that is stored as text, does not need to be decoded
31+
# and can be directly written to a file
32+
# This file is used by the gradle build to sign the APK
33+
- name: Create secrets.gradle
34+
run: echo "${{ secrets.SECRETS_GRADLE }}" > secrets.gradle
2535

2636
- name: Build Prod Release APK
27-
env:
28-
RELEASE_KEYSTORE_PASSWORD: ${{ secrets.RELEASE_KEYSTORE_PASSWORD }}
29-
RELEASE_KEYSTORE_ALIAS: ${{ secrets.RELEASE_KEYSTORE_ALIAS }}
30-
RELEASE_KEY_PASSWORD: ${{ secrets.RELEASE_KEY_PASSWORD }}
3137
run: ./gradlew assembleProdRelease --stacktrace
3238

3339
- name: Upload Release APK to Artifacts
@@ -44,13 +50,9 @@ jobs:
4450
app: ${{ secrets.FIREBASE_PROD_APP_ID }}
4551
credentials: ${{ secrets.FIREBASE_CREDENTIALS }}
4652
# groups: "beta-testers" // add this line if you want to specify a group of testers which will be invited to test this build. Make sure to create the group in Firebase Console first.
47-
releaseNotes: Release build for ${{ github.ref_name }} branch - Run ${{ github.run_number }} - ${{ github.sha }}
53+
release-notes: Release build for ${{ github.ref_name }} branch - Run ${{ github.run_number }} - ${{ github.sha }}
4854

4955
- name: Build Prod Release Bundle
50-
env:
51-
RELEASE_KEYSTORE_PASSWORD: ${{ secrets.RELEASE_KEYSTORE_PASSWORD }}
52-
RELEASE_KEYSTORE_ALIAS: ${{ secrets.RELEASE_KEYSTORE_ALIAS }}
53-
RELEASE_KEY_PASSWORD: ${{ secrets.RELEASE_KEY_PASSWORD }}
5456
run: ./gradlew bundleProdRelease --stacktrace
5557

5658
- name: Upload Release Bundle to Artifacts

.github/workflows/release.yml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ on:
55
pull_request:
66
branches: [ '*' ] # run on all pull requests
77

8+
# Cancel any in-progress runs of this workflow if a new run is triggered within the same branch or PR
9+
concurrency:
10+
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
11+
cancel-in-progress: true
12+
813
jobs:
914
build:
1015
runs-on: macos-latest # use [ self-hosted, macOS ] to host on our own mac mini, which is twice as fast and cheaper than hosting on a github runner. See README for more info.
@@ -20,12 +25,13 @@ jobs:
2025
run: |
2126
echo $ENCODED_STRING > keystore-b64.txt
2227
base64 -d <keystore-b64.txt >upload-keystore.jks
28+
# The secrets.gradle file that is stored as text, does not need to be decoded
29+
# and can be directly written to a file
30+
# This file is used by the gradle build to sign the APK
31+
- name: Create secrets.gradle
32+
run: echo "${{ secrets.SECRETS_GRADLE }}" > secrets.gradle
2333

2434
- name: Build Prod Release APK
25-
env:
26-
RELEASE_KEYSTORE_PASSWORD: ${{ secrets.RELEASE_KEYSTORE_PASSWORD }}
27-
RELEASE_KEYSTORE_ALIAS: ${{ secrets.RELEASE_KEYSTORE_ALIAS }}
28-
RELEASE_KEY_PASSWORD: ${{ secrets.RELEASE_KEY_PASSWORD }}
2935
run: ./gradlew assembleProdRelease --stacktrace
3036

3137
- name: Upload Release APK to Artifacts

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,5 @@
1717
.externalNativeBuild
1818
.cxx
1919
local.properties
20-
21-
fastlane/report.xml
20+
secrets.gradle
21+
upload.keystore.jks

README.MD

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -101,12 +101,12 @@ can [generate a new keystore](https://developer.android.com/studio/publish/app-s
101101
The above command will encode the file contents to base64 and copy it to your clipboard. Save it to
102102
your repo's github secrets in the variable KEYSTORE_BASE_64.
103103

104-
Also [add these repository secrets](./settings/secrets/actions/new) in github, and store them in
105-
your projects 1Password vault as well:
104+
Copy the file `./dummy_secrets.gradle` to `secrets.gradle` and fill in your own keystore details.
106105

107-
- RELEASE_KEYSTORE_PASSWORD ('firstpass' for this template)
108-
- RELEASE_KEYSTORE_ALIAS ('template' for this template)
109-
- RELEASE_KEY_PASSWORD ('secondpass' for this template)
106+
Add the content of secrets.gradle to your Github repository secrets as well, as
107+
`SECRETS_GRADLE`. You can simply copy the content of the file to the github secret, no encoding needed.
108+
109+
Also add the `upload-keystore.jks` file and `secrets.gradle` to 1password. This is important because the secrets cannot be read by any user in github, only by the CI system.
110110

111111
#### Firebase app distribution
112112

@@ -120,9 +120,9 @@ To change this to your own firebase project, you need to set two secrets:
120120
- `FIREBASE_CREDENTIALS` from your firebase project. More info how to obtain it can be found
121121
in [creating a service account](https://github.com/nickwph/firebase-app-distribution-action?tab=readme-ov-file#download-credentials-from-firebase).
122122

123-
With the default configuration, all commits on develop will be pushed to Firebase App Distribution
124-
and users in the test group "beta-testers" will receive an email with a link to download the
125-
app.
123+
With the default configuration, all commits on develop will be pushed to Firebase App Distribution.
124+
To also make these available to a test group, you can enable the `groups` parameter in the
125+
[firebase yml](.github/workflows/firebase-app-distribution.yml) file.
126126

127127
#### Self-hosted runner
128128

app/build.gradle

Lines changed: 38 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@ plugins {
55
alias libs.plugins.compose.compiler
66
}
77

8+
if (file("$rootDir/secrets.gradle").exists()) {
9+
apply from: "$rootDir/secrets.gradle"
10+
} else {
11+
// Dummy secrets file for local development
12+
println "[WARNING] Using dummy secrets file. You will only be able to create debug builds. Please create a secrets.gradle file in the project root with your signing secrets if you want to create release builds."
13+
apply from: "$rootDir/dummy_secrets.gradle"
14+
}
815
apply from: "$rootDir/build.module.feature-and-app.gradle"
916
apply from: "$rootDir/build.dep.navigation.gradle"
1017

@@ -26,12 +33,20 @@ android {
2633
buildConfig = true
2734
}
2835

36+
packaging {
37+
resources {
38+
// Exclude duplicate META-INF files from dependencies to avoid build conflicts
39+
// okhttp3:logging-interceptor and jspecify both contain META-INF/versions/9/OSGI-INF/MANIFEST.MF
40+
excludes += '/META-INF/versions/9/OSGI-INF/MANIFEST.MF'
41+
}
42+
}
43+
2944
signingConfigs {
3045
upload {
3146
storeFile file("../upload-keystore.jks")
32-
storePassword System.getenv("RELEASE_KEYSTORE_PASSWORD")
33-
keyAlias System.getenv("RELEASE_KEYSTORE_ALIAS")
34-
keyPassword System.getenv("RELEASE_KEY_PASSWORD")
47+
storePassword signingSecrets.upload.storePassword
48+
keyAlias signingSecrets.upload.keyAlias
49+
keyPassword signingSecrets.upload.keyPassword
3550
}
3651
}
3752

@@ -79,3 +94,23 @@ dependencies {
7994
api platform(libs.firebaseBoM)
8095
implementation(libs.firebaseCrashlytics)
8196
}
97+
98+
tasks.register("checkSigningConfig") {
99+
doFirst {
100+
def cfg = android.signingConfigs.upload
101+
if(!cfg.storeFile?.exists()) {
102+
throw new GradleException("Keystore file for Signing config 'upload' is not found.")
103+
}
104+
else if (
105+
!cfg.storePassword ||
106+
!cfg.keyAlias ||
107+
!cfg.keyPassword) {
108+
throw new GradleException("Signing config 'upload' is missing values for release build.")
109+
}
110+
}
111+
}
112+
113+
// Attach checkSigningConfig to all release variant preBuild tasks
114+
tasks.matching { it.name =~ /assemble.*Release/ }.configureEach { task ->
115+
task.dependsOn("checkSigningConfig")
116+
}

app/src/main/kotlin/nl/q42/template/logging/CrashlyticsLogger.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package nl.q42.template.logging
22

3-
import com.google.firebase.crashlytics.ktx.crashlytics
4-
import com.google.firebase.ktx.Firebase
3+
import com.google.firebase.Firebase
4+
import com.google.firebase.crashlytics.crashlytics
55
import io.github.aakira.napier.Antilog
66
import io.github.aakira.napier.DebugAntilog
77
import io.github.aakira.napier.LogLevel

build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
33
buildscript {
44
ext {
55
minSdkVersion = 29
6-
targetSdkVersion = 35
7-
compileSdkVersion = 35
6+
targetSdkVersion = 36
7+
compileSdkVersion = 36
88
}
99
}
1010

0 commit comments

Comments
 (0)