Skip to content

Commit

Permalink
chore: work on Android CI
Browse files Browse the repository at this point in the history
  • Loading branch information
robert-virkus committed Dec 27, 2023
1 parent 26afee1 commit 18a72b6
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 78 deletions.
16 changes: 14 additions & 2 deletions .github/workflows/flutter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,18 @@ jobs:
name: Build Android
runs-on: ubuntu-latest
steps:
- name: Decode Keystore and Create key.properties
env:
ENCODED_STRING: ${{ secrets.PLAY_UPLOAD_KEYSTORE }}
PROPERTIES_PATH: ${{ github.workspace }}/android/key.properties
run: |
TMP_KEYSTORE_FILE_PATH="${{ github.workspace }}/android/keystore
mkdir "${TMP_KEYSTORE_FILE_PATH}"
echo $ENCODED_STRING | base64 -di > "${TMP_KEYSTORE_FILE_PATH}"/google_play_upload.jks
echo keyPassword=\${{ secrets.PLAY_UPLOAD_KEY_PASSWORD }} > ${{env.PROPERTIES_PATH}}
echo storePassword=\${{ secrets.PLAY_UPLOAD_STORE_PASSWORD }} >> ${{env.PROPERTIES_PATH}}
echo keyAlias=\${{ secrets.PLAY_KEY_ALIAS }} >> ${{env.PROPERTIES_PATH}}
echo storeFile=\${TMP_KEYSTORE_FILE_PATH}/google_play_upload.jks >> ${{env.PROPERTIES_PATH}}
- uses: actions/checkout@v3
- uses: actions/setup-java@v2
with:
Expand All @@ -21,8 +33,8 @@ jobs:
- run: flutter --version
- run: flutter pub get
#- run: flutter test
# build debug version for now until automated signing is in place:
- run: flutter build apk --debug
- run: flutter build apk --release

apple:
name: Build iOS
runs-on: macos-13 # required for xcode 15, macos-latest does not yet support it, compare https://github.com/maxim-lobanov/setup-xcode/issues/73
Expand Down
121 changes: 45 additions & 76 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,99 +26,68 @@ apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
def keystoreProperties = new Properties()
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))

android {
defaultConfig {
multiDexEnabled true
}

compileOptions {
// Flag to enable support for the new language APIs
coreLibraryDesugaringEnabled true
// Sets Java compatibility to Java 8
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
def keystoreProperties = new Properties()

compileSdkVersion rootProject.ext.compileSdkVersion

sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}

lintOptions {
disable 'InvalidPackage'
}

defaultConfig {
applicationId "de.enough.enough_mail_app"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}

signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile file(keystoreProperties['storeFile'])
storePassword keystoreProperties['storePassword']
}
}
if (keystorePropertiesFile.exists()) {
keystorePropertiesFile.withReader('UTF-8') { reader ->
keystoreProperties.load(reader)
}
}

buildTypes {
release {
signingConfig signingConfigs.release
}
}
android {
defaultConfig {
multiDexEnabled true
}
} else {
System.out.println("warning: android/key.properties not found, now using debug key.")

android {
defaultConfig {
multiDexEnabled true
}
compileOptions {
// Flag to enable support for the new language APIs
coreLibraryDesugaringEnabled true
// Sets Java compatibility to Java 8
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}

compileOptions {
// Flag to enable support for the new language APIs
coreLibraryDesugaringEnabled true
// Sets Java compatibility to Java 8
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
compileSdkVersion rootProject.ext.compileSdkVersion

compileSdkVersion rootProject.ext.compileSdkVersion
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}

sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
lintOptions {
disable 'InvalidPackage'
}

lintOptions {
disable 'InvalidPackage'
}
defaultConfig {
applicationId "de.enough.enough_mail_app"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}

defaultConfig {
applicationId "de.enough.enough_mail_app"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile file(keystoreProperties['storeFile'])
storePassword keystoreProperties['storePassword']
}
}

buildTypes {
release {
signingConfig signingConfigs.debug
buildTypes {
release {
if (keystorePropertiesFile.exists()) {
signingConfig signingConfigs.release
} else {
System.err.println("WARNING: android/key.properties not found, now using debug key.")
signingConfig signingConfigs.debug
}
}
}
}



flutter {
source '../..'
}
Expand Down

0 comments on commit 18a72b6

Please sign in to comment.