Skip to content

Commit

Permalink
feat: add keystore decoding and signing configuration for release builds
Browse files Browse the repository at this point in the history
  • Loading branch information
Dr-Blank committed Sep 23, 2024
1 parent c032595 commit 2aeb3c0
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/flutter_release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
19 changes: 17 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
}
}
}
Expand Down

0 comments on commit 2aeb3c0

Please sign in to comment.