Skip to content

Commit

Permalink
add continuous deployment to firebase
Browse files Browse the repository at this point in the history
  • Loading branch information
josxha committed Feb 6, 2024
1 parent 96f7da7 commit f51c7b3
Show file tree
Hide file tree
Showing 4 changed files with 101 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .firebaserc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"projects": {
"default": "flutter-map-plugins"
}
}
79 changes: 79 additions & 0 deletions .github/workflows/on-commit-main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: Test & Build `main`
on:
push:
branches: [ main ]

concurrency:
group: ${{ github.workflow }}-${{ github.ref || github.run_id }}
cancel-in-progress: true

jobs:
test:
runs-on: ubuntu-latest
name: Build Android
steps:
- name: Checkout project
uses: actions/checkout@v3
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
channel: "stable"
- name: Install melos
run: dart pub global activate melos
- name: Install coverde
run: dart pub global activate coverde
- name: Bootstrap melos
run: melos bootstrap
- name: Run tests with coverage
run: melos run test_with_coverage --no-select
- name: Run Codecov
uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
build-android:
runs-on: ubuntu-latest
name: Build Android
needs: [ test ]
steps:
- name: Checkout project
uses: actions/checkout@v3
- name: Setup Java
uses: actions/setup-java@v2
with:
distribution: 'zulu'
java-version: '21'
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
channel: "stable"
- name: Build APK
working-directory: example
run: flutter build apk
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: apk
path: example/build/app/outputs/flutter-apk/app-release.apk
build-web:
runs-on: ubuntu-latest
needs: [ test ]
if: github.repository == 'josxha/flutter_map_plugins'
defaults:
run:
working-directory: ./example
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
channel: "stable"
- name: Build Web
run: flutter build web
- uses: FirebaseExtended/action-hosting-deploy@v0
with:
repoToken: '${{ secrets.GITHUB_TOKEN }}'
firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_FLUTTER_MAP_PLUGINS }}'
channelId: live
projectId: flutter-map-plugins

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Test & Build
on:
push:
branches: [ main ]
branches-ignore: [ main ]
pull_request:
branches: [ main ]

Expand Down
16 changes: 16 additions & 0 deletions firebase.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"hosting": {
"public": "example/build/web",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"rewrites": [
{
"source": "**",
"destination": "/index.html"
}
]
}
}

0 comments on commit f51c7b3

Please sign in to comment.