From c39d9e0ce878c6ee1544c3475c6c1d80ca2e8e78 Mon Sep 17 00:00:00 2001 From: PiTrem Date: Thu, 7 Dec 2023 12:17:30 +0100 Subject: [PATCH 1/3] ci: create flutter app bundle action --- .github/workflows/flutter.yml | 68 +++++++++++++++++++++++++++++++++++ android/app/build.gradle | 8 +++-- 2 files changed, 73 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/flutter.yml diff --git a/.github/workflows/flutter.yml b/.github/workflows/flutter.yml new file mode 100644 index 0000000..adbdac4 --- /dev/null +++ b/.github/workflows/flutter.yml @@ -0,0 +1,68 @@ +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support +# documentation. + +name: Flutter build appbundle + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-java@v2 + with: + distribution: 'zulu' + java-version: '11' + - uses: subosito/flutter-action@v2 + with: + flutter-version: '3.16.3' + - run: flutter pub get + + - name: set local properties + run: | + echo "" >> ./android/local.properties + echo flutter.minSdkVersion=21 >> ./android/local.properties + echo flutter.targetSdkVersion=30 >> ./android/local.properties + echo flutter.compileSdkVersion=30 >> ./android/local.properties + + - name: test + env: + TEST_INSTANCE_URL: ${{ secrets.TEST_INSTANCE_URL }} + run: | + echo "no testing" +# flutter packages pub run build_runner build +# flutter drive \ +# --dart-define=ELN_USERNAME=complat.user1@eln.edu \ +# --dart-define=ELN_PASSWORD=@complat \ +# --dart-define=ELN_URL=$TEST_INSTANCE_URL +# --driver=test_driver/integration_test.dart \ +# --target=integration_test/app_test.dart + + - name: set key properties + #keyPassword="${{ secrets.KEY_PASSWORD }}" + #storePassword="${{ secrets.STORE_PASSWORD }}" + #keyAlias="${{ secrets.KEY_ALIAS }} + #storeFile=keystore.jks + run: | + echo keyPassword="${{ secrets.KEY_PASSWORD }}" > ./android/key.properties + echo storePassword="${{ secrets.STORE_PASSWORD }}" >> ./android/key.properties + echo keyAlias="${{ secrets.KEY_ALIAS }}" >> ./android/key.properties + echo storeFile=keystore.jks >> ./android/key.properties + echo "${{ secrets.KEY_JKS }}" | base64 --decode > ./android/app/keystore.jks + + # - run: flutter build apk + - run: flutter build appbundle + + - name: Upload artefact + uses: actions/upload-artifact@v3 + with: + name: appbundle + path: build/app/outputs/bundle/release/app-release.aab diff --git a/android/app/build.gradle b/android/app/build.gradle index db86572..68c0700 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -67,12 +67,14 @@ android { } } buildTypes { - if (keystorePropertiesFile.exists()) { - signingConfig signingConfigs.release + if (!keystorePropertiesFile.exists()) { println "Signing with key.properties" + signingConfig signingConfigs.release + } else { - signingConfig signingConfigs.debug println "Signing with debug keys" + signingConfig signingConfigs.debug + } } } From b98db323c8454f5ff46558ac55bdfae4ca5469e2 Mon Sep 17 00:00:00 2001 From: PiTrem Date: Thu, 7 Dec 2023 17:18:50 +0000 Subject: [PATCH 2/3] fix: builtype release properties --- android/app/build.gradle | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index 68c0700..db793b4 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -67,14 +67,14 @@ android { } } buildTypes { - if (!keystorePropertiesFile.exists()) { - println "Signing with key.properties" - signingConfig signingConfigs.release - - } else { - println "Signing with debug keys" - signingConfig signingConfigs.debug - + release { + if (keystorePropertiesFile.exists()) { + println "Signing with key.properties" + signingConfig signingConfigs.release + } else { + println "Signing with debug keys" + signingConfig signingConfigs.debug + } } } } From 4d805672daa9de8694c52ec289cd6a97ba05b61a Mon Sep 17 00:00:00 2001 From: PiTrem Date: Thu, 7 Dec 2023 19:15:36 +0000 Subject: [PATCH 3/3] chore: define localProperties.applicationId --- android/app/build.gradle | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index db793b4..3c490da 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -48,8 +48,7 @@ android { } defaultConfig { - // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). - applicationId "com.example.chemobile" + applicationId "com.chemotion.chemobile" minSdkVersion localProperties.getProperty('flutter.minSdkVersion').toInteger() targetSdkVersion localProperties.getProperty('flutter.targetSdkVersion').toInteger() versionCode flutterVersionCode.toInteger()