diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index a1e06ddaf..29763f637 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,5 +1,7 @@ on: workflow_dispatch name: Test, Build and Release apk +env: + PROPERTIES_PATH: "./android/key.properties" jobs: build: name: Build APK @@ -27,6 +29,16 @@ jobs: - uses: subosito/flutter-action@v2 with: channel: "stable" + + # + - run: | + echo keyPassword=\${{ secrets.KEY_STORE }} > ${{env.PROPERTIES_PATH}} + echo storePassword=\${{ secrets.KEY_PASSWORD }} >> ${{env.PROPERTIES_PATH}} + echo keyAlias=\${{ secrets.KEY_ALIAS }} >> ${{env.PROPERTIES_PATH}} + + # + - run: echo "${{ secrets.KEYSTORE2 }}" | base64 --decode > android/app/key.jks + # Get flutter dependencies. - run: flutter pub get # Check for any formatting issues in the code. diff --git a/android/app/build.gradle b/android/app/build.gradle index 4e56cb5c1..085cd2a3a 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -25,6 +25,12 @@ apply plugin: 'com.android.application' apply plugin: 'kotlin-android' apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" +def keystoreProperties = new Properties() +def keystorePropertiesFile = rootProject.file('key.properties') +if (keystorePropertiesFile.exists()) { + keystoreProperties.load(new FileInputStream(keystorePropertiesFile)) +} + android { compileSdkVersion 32 ndkVersion flutter.ndkVersion @@ -56,11 +62,23 @@ android { versionName flutterVersionName } + signingConfigs { + release { + //From decoded key + storeFile = file('key.jks') + + //From key.properties + keyAlias keystoreProperties['keyAlias'] + keyPassword keystoreProperties['keyPassword'] + 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.release shrinkResources false } } diff --git a/pubspec.yaml b/pubspec.yaml index b9f144e0b..bf6323a71 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -15,7 +15,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. # Read more about iOS versioning at # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html -version: 1.6.0+9 +version: 1.7.0+10 environment: sdk: ">=2.17.3 <3.0.0"