signing config & build apk

This commit is contained in:
austinried 2023-04-28 10:19:38 +09:00
parent f0f812e66a
commit 49b8d2c423
3 changed files with 27 additions and 9 deletions

View File

@ -6,10 +6,11 @@ on:
- v2
jobs:
build-android:
runs-on: ubuntu-latest
build-apk:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: subosito/flutter-action@v2
with:
flutter-version: '3.7.11'
@ -17,7 +18,6 @@ jobs:
cache: true
cache-key: 'flutter-:os:-:channel:-:version:-:arch:-:hash:'
cache-path: '${{ runner.tool_cache }}/flutter/:channel:-:version:-:arch:'
- run: flutter doctor
# - run: flutter pub get
# - run: flutter build apk
# - run: flutter build appbundle
- run: flutter pub get
- run: flutter build apk

1
.gitignore vendored
View File

@ -46,3 +46,4 @@ app.*.map.json
/.env
*.sqlite*
/.fvm/flutter_sdk
*.keystore

View File

@ -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 flutter.compileSdkVersion
ndkVersion flutter.ndkVersion
@ -53,11 +59,22 @@ 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
if (project.hasProperty("signRelease")) {
signingConfig signingConfigs.release
} else {
signingConfig signingConfigs.debug
}
}
}
}