Skip to content

Commit

Permalink
Integrate Fastlane with Firebase App Distribution for Android releases
Browse files Browse the repository at this point in the history
  • Loading branch information
mahmoodhamdi committed Sep 29, 2024
1 parent 1d0a706 commit 3059c38
Show file tree
Hide file tree
Showing 16 changed files with 265 additions and 1 deletion.
6 changes: 6 additions & 0 deletions android/Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
source "https://rubygems.org"

gem "fastlane"

plugins_path = File.join(File.dirname(__FILE__), 'fastlane', 'Pluginfile')
eval_gemfile(plugins_path) if File.exist?(plugins_path)
3 changes: 3 additions & 0 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
plugins {
id "com.android.application"
// START: FlutterFire Configuration
id 'com.google.gms.google-services'
// END: FlutterFire Configuration
id "kotlin-android"
// The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins.
id "dev.flutter.flutter-gradle-plugin"
Expand Down
29 changes: 29 additions & 0 deletions android/app/google-services.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"project_info": {
"project_number": "300451659202",
"project_id": "wirdak-5656",
"storage_bucket": "wirdak-5656.appspot.com"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:300451659202:android:79ca3b6cb06215b2e22a5b",
"android_client_info": {
"package_name": "com.example.wirdak"
}
},
"oauth_client": [],
"api_key": [
{
"current_key": "AIzaSyAyaKYPFzW68molI1zA6CTBNDye5gEDGO0"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": []
}
}
}
],
"configuration_version": "1"
}
2 changes: 2 additions & 0 deletions android/fastlane/Appfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
json_key_file("") # Path to the json secret file - Follow https://docs.fastlane.tools/actions/supply/#setup to get one
package_name("com.example.wirdak") # e.g. com.krausefx.app
17 changes: 17 additions & 0 deletions android/fastlane/Fastfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
default_platform(:android)

platform :android do
desc "Lane For Android Firebase Distribution"
lane :firebase_distribution do
sh "flutter clean"
sh "flutter build apk --release --flavor production -t lib/main_production.dart --no-tree-shake-icons"
firebase_app_distribution(
app: "1:300451659202:android:79ca3b6cb06215b2e22a5b",
release_notes: 'Android Release',
testers: "[email protected], [email protected]",
android_artifact_type: "APK",
android_artifact_path: "../build/app/outputs/flutter-apk/app-production-release.apk",
firebase_cli_token: ENV["FIREBASE_CLI_TOKEN"]
)
end
end
5 changes: 5 additions & 0 deletions android/fastlane/Pluginfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Autogenerated by fastlane
#
# Ensure this file is checked in to source control!

gem 'fastlane-plugin-firebase_app_distribution'
32 changes: 32 additions & 0 deletions android/fastlane/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
fastlane documentation
----

# Installation

Make sure you have the latest version of the Xcode command line tools installed:

```sh
xcode-select --install
```

For _fastlane_ installation instructions, see [Installing _fastlane_](https://docs.fastlane.tools/#installing-fastlane)

# Available Actions

## Android

### android firebase_distribution

```sh
[bundle exec] fastlane android firebase_distribution
```

Lane For Android Firebase Distribution

----

This README.md is auto-generated and will be re-generated every time [_fastlane_](https://fastlane.tools) is run.

More information about _fastlane_ can be found on [fastlane.tools](https://fastlane.tools).

The documentation of _fastlane_ can be found on [docs.fastlane.tools](https://docs.fastlane.tools).
28 changes: 28 additions & 0 deletions android/fastlane/report.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<testsuites>
<testsuite name="fastlane.lanes">




<testcase classname="fastlane.lanes" name="0: default_platform" time="0.0025916">

</testcase>


<testcase classname="fastlane.lanes" name="1: flutter clean" time="1.4624795">

</testcase>


<testcase classname="fastlane.lanes" name="2: flutter build apk --release --flavor production -t lib/main_production.dart --no-tree-shake-icons" time="27.766649">

</testcase>


<testcase classname="fastlane.lanes" name="3: firebase_app_distribution" time="84.6622783">

</testcase>

</testsuite>
</testsuites>
3 changes: 3 additions & 0 deletions android/settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ pluginManagement {
plugins {
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
id "com.android.application" version "8.1.0" apply false
// START: FlutterFire Configuration
id "com.google.gms.google-services" version "4.3.15" apply false
// END: FlutterFire Configuration
id "org.jetbrains.kotlin.android" version "1.8.22" apply false
}

Expand Down
1 change: 1 addition & 0 deletions firebase.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"flutter":{"platforms":{"android":{"default":{"projectId":"wirdak-5656","appId":"1:300451659202:android:79ca3b6cb06215b2e22a5b","fileOutput":"android/app/google-services.json"}},"dart":{"lib/firebase_options.dart":{"projectId":"wirdak-5656","configurations":{"android":"1:300451659202:android:79ca3b6cb06215b2e22a5b","ios":"1:300451659202:ios:449021c3aa24239de22a5b","macos":"1:300451659202:ios:449021c3aa24239de22a5b","web":"1:300451659202:web:3fdf9a9648ca69cce22a5b","windows":"1:300451659202:web:07e8606ab120e416e22a5b"}}}}}}
86 changes: 86 additions & 0 deletions lib/firebase_options.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
// File generated by FlutterFire CLI.
// ignore_for_file: type=lint
import 'package:firebase_core/firebase_core.dart' show FirebaseOptions;
import 'package:flutter/foundation.dart'
show defaultTargetPlatform, kIsWeb, TargetPlatform;

/// Default [FirebaseOptions] for use with your Firebase apps.
///
/// Example:
/// ```dart
/// import 'firebase_options.dart';
/// // ...
/// await Firebase.initializeApp(
/// options: DefaultFirebaseOptions.currentPlatform,
/// );
/// ```
class DefaultFirebaseOptions {
static FirebaseOptions get currentPlatform {
if (kIsWeb) {
return web;
}
switch (defaultTargetPlatform) {
case TargetPlatform.android:
return android;
case TargetPlatform.iOS:
return ios;
case TargetPlatform.macOS:
return macos;
case TargetPlatform.windows:
return windows;
case TargetPlatform.linux:
throw UnsupportedError(
'DefaultFirebaseOptions have not been configured for linux - '
'you can reconfigure this by running the FlutterFire CLI again.',
);
default:
throw UnsupportedError(
'DefaultFirebaseOptions are not supported for this platform.',
);
}
}

static const FirebaseOptions web = FirebaseOptions(
apiKey: 'AIzaSyCQXdyKNITrJCAvJwf1c0Z3ex308OILWWQ',
appId: '1:300451659202:web:3fdf9a9648ca69cce22a5b',
messagingSenderId: '300451659202',
projectId: 'wirdak-5656',
authDomain: 'wirdak-5656.firebaseapp.com',
storageBucket: 'wirdak-5656.appspot.com',
);

static const FirebaseOptions android = FirebaseOptions(
apiKey: 'AIzaSyAyaKYPFzW68molI1zA6CTBNDye5gEDGO0',
appId: '1:300451659202:android:79ca3b6cb06215b2e22a5b',
messagingSenderId: '300451659202',
projectId: 'wirdak-5656',
storageBucket: 'wirdak-5656.appspot.com',
);

static const FirebaseOptions ios = FirebaseOptions(
apiKey: 'AIzaSyDNQjG5xmhB-W3ZhJyQIIXZIwqB3y9WB1I',
appId: '1:300451659202:ios:449021c3aa24239de22a5b',
messagingSenderId: '300451659202',
projectId: 'wirdak-5656',
storageBucket: 'wirdak-5656.appspot.com',
iosBundleId: 'com.example.wirdak',
);

static const FirebaseOptions macos = FirebaseOptions(
apiKey: 'AIzaSyDNQjG5xmhB-W3ZhJyQIIXZIwqB3y9WB1I',
appId: '1:300451659202:ios:449021c3aa24239de22a5b',
messagingSenderId: '300451659202',
projectId: 'wirdak-5656',
storageBucket: 'wirdak-5656.appspot.com',
iosBundleId: 'com.example.wirdak',
);

static const FirebaseOptions windows = FirebaseOptions(
apiKey: 'AIzaSyCQXdyKNITrJCAvJwf1c0Z3ex308OILWWQ',
appId: '1:300451659202:web:07e8606ab120e416e22a5b',
messagingSenderId: '300451659202',
projectId: 'wirdak-5656',
authDomain: 'wirdak-5656.firebaseapp.com',
storageBucket: 'wirdak-5656.appspot.com',
);
}
2 changes: 2 additions & 0 deletions macos/Flutter/GeneratedPluginRegistrant.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import FlutterMacOS
import Foundation

import firebase_core

func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
FLTFirebaseCorePlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseCorePlugin"))
}
47 changes: 46 additions & 1 deletion pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,30 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.3.1"
firebase_core:
dependency: "direct main"
description:
name: firebase_core
sha256: "51dfe2fbf3a984787a2e7b8592f2f05c986bfedd6fdacea3f9e0a7beb334de96"
url: "https://pub.dev"
source: hosted
version: "3.6.0"
firebase_core_platform_interface:
dependency: transitive
description:
name: firebase_core_platform_interface
sha256: e30da58198a6d4b49d5bce4e852f985c32cb10db329ebef9473db2b9f09ce810
url: "https://pub.dev"
source: hosted
version: "5.3.0"
firebase_core_web:
dependency: transitive
description:
name: firebase_core_web
sha256: f967a7138f5d2ffb1ce15950e2a382924239eaa521150a8f144af34e68b3b3e5
url: "https://pub.dev"
source: hosted
version: "2.18.1"
flutter:
dependency: "direct main"
description: flutter
Expand All @@ -75,6 +99,11 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
flutter_web_plugins:
dependency: transitive
description: flutter
source: sdk
version: "0.0.0"
leak_tracker:
dependency: transitive
description:
Expand Down Expand Up @@ -139,6 +168,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.9.0"
plugin_platform_interface:
dependency: transitive
description:
name: plugin_platform_interface
sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02"
url: "https://pub.dev"
source: hosted
version: "2.1.8"
sky_engine:
dependency: transitive
description: flutter
Expand Down Expand Up @@ -208,6 +245,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "14.2.5"
web:
dependency: transitive
description:
name: web
sha256: cd3543bd5798f6ad290ea73d210f423502e71900302dde696f8bff84bf89a1cb
url: "https://pub.dev"
source: hosted
version: "1.1.0"
sdks:
dart: ">=3.5.3 <4.0.0"
flutter: ">=3.18.0-18.0.pre.54"
flutter: ">=3.22.0"
1 change: 1 addition & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ dependencies:
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.8
firebase_core: ^3.6.0

dev_dependencies:
flutter_test:
Expand Down
3 changes: 3 additions & 0 deletions windows/flutter/generated_plugin_registrant.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@

#include "generated_plugin_registrant.h"

#include <firebase_core/firebase_core_plugin_c_api.h>

void RegisterPlugins(flutter::PluginRegistry* registry) {
FirebaseCorePluginCApiRegisterWithRegistrar(
registry->GetRegistrarForPlugin("FirebaseCorePluginCApi"));
}
1 change: 1 addition & 0 deletions windows/flutter/generated_plugins.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#

list(APPEND FLUTTER_PLUGIN_LIST
firebase_core
)

list(APPEND FLUTTER_FFI_PLUGIN_LIST
Expand Down

0 comments on commit 3059c38

Please sign in to comment.