From f4fd47e911d70dc079e0789fc086a071ff7a0b59 Mon Sep 17 00:00:00 2001
From: Peter Jankuliak
Date: Tue, 3 Dec 2024 11:01:39 +0100
Subject: [PATCH] Fix CI signing of nightly builds
---
.github/workflows/ci.yml | 2 +-
android/app/build.gradle | 14 ++++++++++----
util/release.dart | 9 +++++++--
3 files changed, 18 insertions(+), 7 deletions(-)
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index a6bfb266..a578d607 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -155,7 +155,7 @@ jobs:
- name: Setup secrets for artifact signing (different from the production releases)
run: |
- dir=secrets/nightly/android
+ dir=secrets/android
mkdir -p $dir
echo $NIGHTLY_KEYSTORE_JKS_HEX > $dir/keystore.jks.hex
# Use `keytool` to generate the `keystore.jks` keystore.
diff --git a/android/app/build.gradle b/android/app/build.gradle
index ceecf54d..dc8fb7ed 100644
--- a/android/app/build.gradle
+++ b/android/app/build.gradle
@@ -161,13 +161,19 @@ def loadKeystorePropertiesFile(String keystorePropertiesPath) {
}
def properties = new Properties()
- def proFile = rootProject.file(keystorePropertiesPath)
+ def propFile = rootProject.file(keystorePropertiesPath)
- if (!proFile.exists()) {
- return null
+ if (!propFile.exists()) {
+ throw new GradleException("The keystore properties file does not exist: ${keystorePropertiesPath}");
}
- proFile.withInputStream { properties.load(it) }
+ propFile.withInputStream { properties.load(it) }
+
+ def storeFile = file(properties['storeFile']);
+
+ if (!storeFile.exists()) {
+ throw new GradleException("The store file does not exist: ${storeFile.getPath()}");
+ }
def config = new SigningConfig(
keyAlias: properties['keyAlias'],
diff --git a/util/release.dart b/util/release.dart
index 302e9315..a16a5913 100644
--- a/util/release.dart
+++ b/util/release.dart
@@ -379,14 +379,19 @@ class Options {
}
}
- final androidKeyProperties = results['android-key-properties'];
+ String? androidKeyProperties = results['android-key-properties'];
if (androidKeyProperties != null) {
- if (!await File(androidKeyProperties).exists()) {
+ final file = File(androidKeyProperties);
+ if (!await file.exists()) {
print(
"Android keystore properties file '$androidKeyProperties' does not exist");
exit(1);
}
+
+ // Convert to absolute path because if it's relative the build.gradle
+ // script expects it to be relative to the ./android/ directory.
+ androidKeyProperties = file.absolute.path;
}
final sentryDSNFile = results['sentry'];