From 2aeb3c059d47d5eb73dffbdf1e2d1960e574ee3a Mon Sep 17 00:00:00 2001 From: Dr-Blank <64108942+Dr-Blank@users.noreply.github.com> Date: Mon, 23 Sep 2024 01:05:45 -0400 Subject: [PATCH] feat: add keystore decoding and signing configuration for release builds --- .github/workflows/flutter_release.yaml | 6 ++++++ android/app/build.gradle | 19 +++++++++++++++++-- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/.github/workflows/flutter_release.yaml b/.github/workflows/flutter_release.yaml index 3ba9d6b..b1f7c0a 100644 --- a/.github/workflows/flutter_release.yaml +++ b/.github/workflows/flutter_release.yaml @@ -41,6 +41,12 @@ jobs: # - name: Run tests # run: flutter test + - name: Decode android/neumodore_key.jks + run: echo "${{ secrets.UPLOAD_KEYSTORE_JKS }}" | base64 --decode > android/upload.jks + + - name: Decode android/key.properties + run: echo "${{ secrets.KEY_PROPERTIES }}" | base64 --decode > android/key.properties + - name: Build APK run: flutter build apk --release diff --git a/android/app/build.gradle b/android/app/build.gradle index 0759e63..b13356f 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -22,6 +22,12 @@ if (flutterVersionName == null) { flutterVersionName = '1.0' } +def keystoreProperties = new Properties() +def keystorePropertiesFile = rootProject.file('key.properties') +if (keystorePropertiesFile.exists()) { + keystoreProperties.load(new FileInputStream(keystorePropertiesFile)) +} + android { namespace "dr.blank.vaani" compileSdk flutter.compileSdkVersion @@ -51,11 +57,20 @@ android { versionName flutterVersionName } + signingConfigs { + release { + keyAlias = keystoreProperties['keyAlias'] + keyPassword = keystoreProperties['keyPassword'] + storeFile = keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null + storePassword = keystoreProperties['storePassword'] + } + } + 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.debug + // signingConfig signingConfigs.debug + signingConfig = signingConfigs.release } } }