From 7a4defbab4dc378cb7acc681e654eb9b52d1686c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bot=20of=20Thomas=20G=C3=BCttler?= Date: Fri, 5 Jun 2026 11:48:46 +0200 Subject: [PATCH] fix: make Android signing config conditional on ANDROID_KEYSTORE_PATH (#440) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Summary - `BuildAndroidRelease` in `ci/main.go` intentionally builds the AAB without setting up the keystore — the unsigned AAB is later stamped with `StampAndroidVersionCode` and re-signed by `SignAndroidBundle` via jarsigner. - The old `signingConfigs.create("release")` block in `android/app/build.gradle.kts` called `error("ANDROID_KEYSTORE_PATH is not set")` at Gradle _configuration_ time, which fired even when the keystore wasn't needed for the build step. - Fix: guard the `signingConfigs` block and the `signingConfig` assignment in the release build type behind a null-check on `ANDROID_KEYSTORE_PATH`. When the env var is absent (unsigned build path), Gradle skips the signing config entirely; when it is present (e.g. `BuildAndroidApk` via `setupKeystore`), the config is created and applied as before. ## Test plan - Trigger `deploy.yml` via `workflow_dispatch` and verify the `Build & Deploy to Play Store` job no longer fails at step 4 with "ANDROID_KEYSTORE_PATH is not set" - Verify `BuildAndroidApk` (which calls `setupKeystore`) still produces a correctly signed APK Closes #439 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Thomas SharedInbox Reviewed-on: https://codeberg.org/guettli/sharedinbox/pulls/440 --- android/app/build.gradle.kts | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/android/app/build.gradle.kts b/android/app/build.gradle.kts index 15eb163..e836343 100644 --- a/android/app/build.gradle.kts +++ b/android/app/build.gradle.kts @@ -22,13 +22,17 @@ android { } } - signingConfigs { - create("release") { - keyAlias = "upload" - val pass = System.getenv("ANDROID_KEYSTORE_PASSWORD") - storePassword = pass - keyPassword = pass - storeFile = file(System.getenv("ANDROID_KEYSTORE_PATH") ?: error("ANDROID_KEYSTORE_PATH is not set")) + val ksPath: String? = System.getenv("ANDROID_KEYSTORE_PATH") + + if (ksPath != null) { + signingConfigs { + create("release") { + keyAlias = "upload" + val pass = System.getenv("ANDROID_KEYSTORE_PASSWORD") ?: "" + storePassword = pass + keyPassword = pass + storeFile = file(ksPath) + } } } @@ -44,7 +48,9 @@ android { buildTypes { release { - signingConfig = signingConfigs.getByName("release") + if (ksPath != null) { + signingConfig = signingConfigs.getByName("release") + } isMinifyEnabled = false isShrinkResources = false ndk {