Skip to content

Commit 9d26e36

Browse files
Set up firebase distribution
1 parent 669b805 commit 9d26e36

5 files changed

Lines changed: 67 additions & 13 deletions

File tree

.github/workflows/flutter-ci-cd.yml

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,11 @@ name: Flutter CI CD
33
on:
44
push:
55
branches:
6-
- main
7-
- develop
6+
- ci-cd-git-pipeline
87

98
pull_request:
109
branches:
11-
- main
12-
- develop
10+
- ci-cd-git-pipeline
1311

1412
workflow_dispatch:
1513

@@ -43,8 +41,9 @@ jobs:
4341
- name: Analyze project
4442
run: flutter analyze --no-fatal-infos --no-fatal-warnings
4543

46-
# - name: Run tests
47-
# run: flutter test
44+
- name: Run tests optional
45+
run: flutter test
46+
continue-on-error: true
4847

4948
- name: Build release APK
5049
run: flutter build apk --release
@@ -55,6 +54,22 @@ jobs:
5554
name: flutter-release-apk
5655
path: build/app/outputs/flutter-apk/app-release.apk
5756

57+
- name: Create Firebase service account file
58+
run: |
59+
echo '${{ secrets.FIREBASE_SERVICE_ACCOUNT_JSON }}' > firebase-service-account.json
60+
61+
- name: Install Firebase CLI
62+
run: npm install -g firebase-tools
63+
64+
- name: Upload APK to Firebase App Distribution
65+
run: |
66+
firebase appdistribution:distribute build/app/outputs/flutter-apk/app-release.apk \
67+
--app "${{ secrets.FIREBASE_ANDROID_APP_ID }}" \
68+
--groups "testers" \
69+
--release-notes "Branch: $GITHUB_REF_NAME | Commit: $GITHUB_SHA"
70+
env:
71+
GOOGLE_APPLICATION_CREDENTIALS: firebase-service-account.json
72+
5873
web-build:
5974
name: Build Flutter Web
6075
runs-on: ubuntu-latest
@@ -70,7 +85,7 @@ jobs:
7085
cache: true
7186

7287
- name: Get dependencies
73-
run: flutter pub get
88+
run: flutter pub get --no-precompile
7489

7590
- name: Enable web
7691
run: flutter config --enable-web

android/app/build.gradle.kts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,21 @@
11
plugins {
22
id("com.android.application")
3+
34
id("kotlin-android")
45
// The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins.
56
id("dev.flutter.flutter-gradle-plugin")
7+
8+
id("com.google.gms.google-services")
9+
}
10+
11+
12+
dependencies {
13+
implementation(platform("com.google.firebase:firebase-bom:34.12.0"))
14+
implementation("com.google.firebase:firebase-analytics")
615
}
716

817
android {
9-
namespace = "com.example.flutter_mvvm_provider"
18+
namespace = "com.app.flutter_mvvm_provider"
1019
compileSdk = flutter.compileSdkVersion
1120
ndkVersion = flutter.ndkVersion
1221

@@ -21,7 +30,7 @@ android {
2130

2231
defaultConfig {
2332
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
24-
applicationId = "com.example.flutter_mvvm_provider"
33+
applicationId = "com.app.flutter_mvvm_provider"
2534
// You can update the following values to match your application needs.
2635
// For more information, see: https://flutter.dev/to/review-gradle-config.
2736
minSdk = flutter.minSdkVersion

android/app/google-services.json

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"project_info": {
3+
"project_number": "505721379717",
4+
"project_id": "flutter-mvvm-provider-f4b7f",
5+
"storage_bucket": "flutter-mvvm-provider-f4b7f.firebasestorage.app"
6+
},
7+
"client": [
8+
{
9+
"client_info": {
10+
"mobilesdk_app_id": "1:505721379717:android:7cc49127018365eee742ec",
11+
"android_client_info": {
12+
"package_name": "com.app.flutter_mvvm_provider"
13+
}
14+
},
15+
"oauth_client": [],
16+
"api_key": [
17+
{
18+
"current_key": "AIzaSyB33Du5FMWYRNbc8KSUasm2xuzBnt9In40"
19+
}
20+
],
21+
"services": {
22+
"appinvite_service": {
23+
"other_platform_oauth_client": []
24+
}
25+
}
26+
}
27+
],
28+
"configuration_version": "1"
29+
}

android/build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ allprojects {
1010
plugins {
1111
id("com.android.application") apply false
1212
id("org.jetbrains.kotlin.android") apply false
13+
id("com.google.gms.google-services") version "4.4.4" apply false
1314
}
1415

1516
val newBuildDir: Directory = rootProject.layout.buildDirectory.dir("../../build").get()

lib/core/firebase_options.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,11 @@ class DefaultFirebaseOptions {
3939
}
4040

4141
static const FirebaseOptions android = FirebaseOptions(
42-
apiKey: '',
43-
appId: '',
42+
apiKey: 'AIzaSyB33Du5FMWYRNbc8KSUasm2xuzBnt9In40',
43+
appId: '1:505721379717:android:7cc49127018365eee742ec',
4444
messagingSenderId: '',
45-
projectId: '',
46-
storageBucket: '',
45+
projectId: 'flutter-mvvm-provider-f4b7f',
46+
storageBucket: 'flutter-mvvm-provider-f4b7f.firebasestorage.app',
4747
);
4848

4949
static const FirebaseOptions ios = FirebaseOptions(

0 commit comments

Comments
 (0)