diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index aebef22..114e413 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -33,6 +33,18 @@ jobs: - name: Analyze project source run: flutter analyze + - name: Restore Android keystore .jsk and .properties files + env: + KEYSTORE: ${{ secrets.KEYSTORE }} + KEYSTORE_PROPERTIES: ${{ secrets.KEYSTORE_PROPERTIES }} + run: | + KEYSTORE_PATH=$RUNNER_TEMP/keystore.jks + echo -n "$KEYSTORE" | base64 --decode --output $KEYSTORE_PATH + cp $KEYSTORE_PATH ./android/app + KEYSTORE_PROPERTIES_PATH=$RUNNER_TEMP/key.properties + echo -n "$KEYSTORE_PROPERTIES" | base64 --decode --output $KEYSTORE_PROPERTIES_PATH + cp $KEYSTORE_PROPERTIES_PATH ./android + - name: Build Apk run: flutter build apk --flavor dev --dart-define cameraPreviewAspectRatio=2/3 -t lib/main_dev.dart diff --git a/android/app/build.gradle b/android/app/build.gradle index aedfc58..b0bbcdd 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -21,6 +21,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)) +} + apply plugin: 'com.android.application' apply plugin: 'kotlin-android' apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" @@ -50,15 +56,12 @@ android { } signingConfigs { - debug {} - /* release { keyAlias keystoreProperties['keyAlias'] keyPassword keystoreProperties['keyPassword'] storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null storePassword keystoreProperties['storePassword'] } - */ } flavorDimensions "app"