Skip to content

Commit

Permalink
With release
Browse files Browse the repository at this point in the history
  • Loading branch information
tuhinpal committed Mar 16, 2024
1 parent 93570b6 commit 4fc0175
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 17 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/build-apk.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name: Android Flutter Build

on:
# push:
# branches:
# - main
push:
branches:
- main
workflow_dispatch:

jobs:
Expand All @@ -29,10 +29,10 @@ jobs:
run: flutter pub get

- name: Build APK
run: flutter build apk
run: flutter build apk --debug

- name: Archive artifacts
uses: actions/upload-artifact@v2
with:
name: app-release.apk
path: build/app/outputs/flutter-apk/app-release.apk
name: app-debug.apk
path: build/app/outputs/flutter-apk/app-debug.apk
20 changes: 17 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Android Flutter Build then Release

on:
release:
types: [created, edited]
types: [created]

jobs:
build:
Expand All @@ -13,10 +13,24 @@ jobs:
- name: Checkout code
uses: actions/checkout@v2

- name: Setup Java
uses: actions/setup-java@v2
with:
distribution: 'temurin' # AdoptOpenJDK
java-version: '11'

- name: Decode Keystore
run: |
echo "${{ secrets.KEYSTORE_BASE64 }}" | base64 -d > android/key.jks
- name: Create Key Properties
run: |
echo "${{ secrets.KEY_PROPERTIES }}" > android/key.properties
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: '3.19.3' # Your current version of flutter
flutter-version: '3.19.3' # My current version of flutter
channel: 'stable'
cache: true
cache-key: 'flutter-:os:-:channel:-:version:-:arch:-:hash:'
Expand All @@ -27,7 +41,7 @@ jobs:
run: flutter pub get

- name: Build APK
run: flutter build apk
run: flutter build apk --release

- name: Upload APK to Release
uses: actions/upload-release-asset@v1
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,4 @@ app.*.map.json
/android/app/debug
/android/app/profile
/android/app/release
/android/key.jks.base64
29 changes: 21 additions & 8 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
namespace "com.example.cash_compass"
compileSdkVersion flutter.compileSdkVersion
Expand All @@ -45,7 +51,7 @@ android {

defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.cash_compass"
applicationId "com.tuhin.cash_compass"
// You can update the following values to match your application needs.
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
minSdkVersion flutter.minSdkVersion
Expand All @@ -54,13 +60,20 @@ android {
versionName flutterVersionName
}

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
}
}
signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
storePassword keystoreProperties['storePassword']
}
}

buildTypes {
release {
signingConfig signingConfigs.release
}
}
}

flutter {
Expand Down

0 comments on commit 4fc0175

Please sign in to comment.