ci: implement Android build and test stage
- Add .gitea/workflows/ci.yml: lint -> test -> build-android -> build-ios pipeline - Flutter 3.41.x aligned with devcontainer (was 3.27.x) - Java 17 (temurin) with Gradle build cache - flutter precache --android + SDK license acceptance (CI crash fixes) - Conditional release signing via ANDROID_KEYSTORE_* secrets - Pre-build gates (analyze + test) skip expensive build on failure - Conditional whitelabel build script (only when theme.json exists) - APK + AAB artifact upload (90-day retention) - Add .gitea/workflows/release.yml: tag-triggered release pipeline - Lint -> test -> build-android -> build-ios -> publish-release - Gitea Release creation with APK attachment - Fixed Gitea API auth (was leaking placeholder '***' token) - Apple signing support via APPLE_CERTIFICATE_* secrets - Update android/app/build.gradle.kts: conditional release signing - signingConfigs.release block loads from key.properties when present - Falls back to debug signing when key.properties absent - Backward compatible with local dev (no secrets required)
This commit is contained in:
@@ -12,6 +12,13 @@ dependencies {
|
||||
implementation("androidx.media:media:1.7.0")
|
||||
}
|
||||
|
||||
// Load release signing properties if key.properties exists (set by CI pipeline)
|
||||
val keystorePropertiesFile = rootProject.file("key.properties")
|
||||
val keystoreProperties = java.util.Properties()
|
||||
if (keystorePropertiesFile.exists()) {
|
||||
keystoreProperties.load(java.io.FileInputStream(keystorePropertiesFile))
|
||||
}
|
||||
|
||||
android {
|
||||
namespace = "com.example.kryz_go_flutter"
|
||||
compileSdk = flutter.compileSdkVersion
|
||||
@@ -37,11 +44,25 @@ android {
|
||||
versionName = flutter.versionName
|
||||
}
|
||||
|
||||
signingConfigs {
|
||||
create("release") {
|
||||
if (keystorePropertiesFile.exists()) {
|
||||
keyAlias = keystoreProperties["keyAlias"] as String
|
||||
keyPassword = keystoreProperties["keyPassword"] as String
|
||||
storeFile = file(keystoreProperties["storeFile"] as String)
|
||||
storePassword = keystoreProperties["storePassword"] as String
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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")
|
||||
// Use release signing if key.properties exists, otherwise fall back to debug.
|
||||
if (keystorePropertiesFile.exists()) {
|
||||
signingConfig = signingConfigs.getByName("release")
|
||||
} else {
|
||||
signingConfig = signingConfigs.getByName("debug")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user