Fix release signing and unify "+" upload with the share-intent path
Build APK / build (push) Successful in 5m21s
Build APK / build (push) Successful in 5m21s
- Release builds now sign with a dedicated keystore (local android/key.properties or CI secrets, both gitignored) instead of each machine's own debug key, so a downloaded release APK can actually update a previous install instead of failing with "App not installed" (mismatched signature). - The Files tab's "+" -> "Upload File" now goes through the same ShareUploadView destination picker and background foreground-service upload as receiving a file via Android's "Share to..." sheet, instead of a separate blocking in-app-only upload path. Removed the now-unused ServerProvider/NextcloudService.uploadFileFromPath. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -13,3 +13,4 @@ GeneratedPluginRegistrant.java
|
||||
key.properties
|
||||
**/*.keystore
|
||||
**/*.jks
|
||||
RELEASE_SIGNING_SECRETS.txt
|
||||
|
||||
@@ -1,9 +1,35 @@
|
||||
import java.util.Properties
|
||||
|
||||
plugins {
|
||||
id("com.android.application")
|
||||
// The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins.
|
||||
id("dev.flutter.flutter-gradle-plugin")
|
||||
}
|
||||
|
||||
// Release signing: prefer a local android/key.properties (gitignored, for
|
||||
// a developer machine that has the release keystore), then CI env vars
|
||||
// (set by .gitea/workflows/build.yml from repo secrets), then null - which
|
||||
// falls back to debug signing below so an unconfigured checkout still
|
||||
// builds/runs fine, same as before this existed.
|
||||
val releaseKeystoreProperties = Properties().apply {
|
||||
val propsFile = rootProject.file("key.properties")
|
||||
if (propsFile.exists()) propsFile.inputStream().use { load(it) }
|
||||
}
|
||||
|
||||
fun releaseSigningValue(propertyKey: String, envKey: String): String? =
|
||||
releaseKeystoreProperties.getProperty(propertyKey) ?: System.getenv(envKey)
|
||||
|
||||
val releaseStoreFile = releaseSigningValue("storeFile", "RELEASE_KEYSTORE_PATH")
|
||||
val releaseStorePassword = releaseSigningValue("storePassword", "RELEASE_KEYSTORE_PASSWORD")
|
||||
val releaseKeyAlias = releaseSigningValue("keyAlias", "RELEASE_KEY_ALIAS")
|
||||
val releaseKeyPassword = releaseSigningValue("keyPassword", "RELEASE_KEY_PASSWORD")
|
||||
val hasReleaseSigning = listOf(
|
||||
releaseStoreFile,
|
||||
releaseStorePassword,
|
||||
releaseKeyAlias,
|
||||
releaseKeyPassword,
|
||||
).all { !it.isNullOrBlank() }
|
||||
|
||||
android {
|
||||
namespace = "dev.ayushya.noo"
|
||||
compileSdk = flutter.compileSdkVersion
|
||||
@@ -27,11 +53,27 @@ android {
|
||||
versionName = flutter.versionName
|
||||
}
|
||||
|
||||
signingConfigs {
|
||||
if (hasReleaseSigning) {
|
||||
create("release") {
|
||||
storeFile = file(releaseStoreFile!!)
|
||||
storePassword = releaseStorePassword
|
||||
keyAlias = releaseKeyAlias
|
||||
keyPassword = releaseKeyPassword
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
// TODO: Add your own signing config for the release build.
|
||||
// Signing with the debug keys for now, so `flutter run --release` works.
|
||||
signingConfig = signingConfigs.getByName("debug")
|
||||
// Falls back to the debug keystore (so an unconfigured
|
||||
// checkout can still `flutter run --release`) when no release
|
||||
// signing config is available - see the comment above.
|
||||
signingConfig = if (hasReleaseSigning) {
|
||||
signingConfigs.getByName("release")
|
||||
} else {
|
||||
signingConfigs.getByName("debug")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user