-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci(github-actions): Added better build script for the deploy to githu…
…b pages
- Loading branch information
1 parent
b4fafa4
commit bbaae74
Showing
3 changed files
with
60 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,37 @@ | ||
name: Deploy static content to Pages | ||
name: Deploy to github pages | ||
|
||
on: | ||
push: | ||
branches: ["main"] | ||
|
||
permissions: | ||
contents: read | ||
pages: write | ||
id-token: write | ||
|
||
jobs: | ||
build: | ||
deploy: | ||
environment: | ||
name: github-pages | ||
url: ${{ steps.deployment.outputs.page_url }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: subosito/flutter-action@v1 | ||
- uses: bluefireteam/flutter-gh-pages@v7 | ||
- name: Setup Pages | ||
uses: actions/configure-pages@v3 | ||
- uses: actions/checkout@v4 | ||
- uses: kuhnroyal/flutter-fvm-config-action@v2 | ||
id: fvm-config-action | ||
- uses: subosito/flutter-action@v2 | ||
with: | ||
flutter-version: ${{ steps.fvm-config-action.outputs.FLUTTER_VERSION }} | ||
channel: ${{ steps.fvm-config-action.outputs.FLUTTER_CHANNEL }} | ||
- run: flutter packages get | ||
- run: dart analyze | ||
- run: flutter build web | ||
- name: Upload artifact | ||
uses: actions/upload-pages-artifact@v1 | ||
with: | ||
path: './build/web' | ||
- name: Deploy to GitHub Pages | ||
id: deployment | ||
uses: actions/deploy-pages@v1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
import 'package:firebase_core/firebase_core.dart'; | ||
import 'package:flutter_belgium/di/injectable.dart'; | ||
import 'package:flutter_belgium/firebase_options.dart'; | ||
import 'package:flutter_belgium/repo/login_repo.dart'; | ||
import 'package:flutter_belgium/util/firebase/firebase_config.dart'; | ||
|
||
Future<void> initFirebase() async { | ||
await Firebase.initializeApp(options: DefaultFirebaseOptions.currentPlatform); | ||
await Firebase.initializeApp(options: FirebaseConfig.currentPlatform); | ||
getIt<LoginRepository>().init(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import 'package:firebase_core/firebase_core.dart'; | ||
import 'package:flutter/foundation.dart'; | ||
// import 'package:flutter_belgium/firebase_options.dart'; | ||
|
||
class FirebaseConfig { | ||
static FirebaseOptions get currentPlatform { | ||
if (kIsWeb) { | ||
return _web; | ||
} | ||
throw UnsupportedError('This platform is not supported'); | ||
// try { | ||
// return DefaultFirebaseOptions.currentPlatform; | ||
// } catch (e) { | ||
// return DefaultFirebaseOptions.currentPlatform; | ||
// } | ||
} | ||
|
||
static const FirebaseOptions _web = FirebaseOptions( | ||
apiKey: String.fromEnvironment('FIREBASE_API_KEY'), | ||
appId: String.fromEnvironment('FIREBASE_APP_ID'), | ||
messagingSenderId: String.fromEnvironment('FIREBASE_MESSAGING_SENDER_ID'), | ||
projectId: String.fromEnvironment('FIREBASE_PROJECT_ID'), | ||
authDomain: String.fromEnvironment('FIREBASE_AUTH_DOMAIN'), | ||
storageBucket: String.fromEnvironment('FIREBASE_STORAGE_BUCKET'), | ||
measurementId: String.fromEnvironment('FIREBASE_MEASUREMENT_ID'), | ||
); | ||
} |