Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
November 24, 2021 09:57 am GMT

Flutter Web x Firebase Hosting - GitHub Action

My Workflow

This GitHub Actions workflow assists Flutter developers specifically outputting to Web.
Please see the additional resource below to stay up-to-date with the required tools for this workflow to work.

The YAML files below are partially auto-generated by the Firebase CLI when setting up hosting but require additional DIY steps included for you to use directly after replacing the placeholders with the names of your secrets, project IDs, and preferred hosting channels.

Submission Category:

DIY Deployments

Yaml Files

Deploy to Firebase Hosting on Merge

# This file was PARTIALLY auto-generated by the Firebase CLI# https://github.com/firebase/firebase-toolsname: Deploy to Firebase Hosting on merge'on':  push:    branches:      - masterjobs:  build_and_deploy:    runs-on: ubuntu-latest    steps:      - uses: actions/checkout@v2      - uses: subosito/flutter-action@v1 #required (unofficial as no official tool exists, yet!)        with:          channel: 'stable' # or: 'beta', 'dev' or 'master'      - run: flutter pub get && flutter build web      - uses: FirebaseExtended/action-hosting-deploy@v0        with:          repoToken: '${{ secrets.GITHUB_TOKEN }}'          firebaseServiceAccount: '${{ secrets.YOUR-FIREBASE-SERVICE-ACCOUNT-SECRET-NAME }}'          channelId: live #Your preferred Firebase channel          projectId: YOUR-PROJECT-ID

Deploy to Firebase Hosting on PR

# This file was PARTIALLY auto-generated by the Firebase CLI# https://github.com/firebase/firebase-toolsname: Deploy to Firebase Hosting on PR'on': pull_requestjobs:  build_and_preview:    if: '${{ github.event.pull_request.head.repo.full_name == github.repository }}'    runs-on: ubuntu-latest    steps:      - uses: actions/checkout@v2      - uses: subosito/flutter-action@v1 #required (unofficial as no official tool exists, yet!)        with:          channel: 'stable' # or: 'beta', 'dev' or 'master'      - run: flutter pub get && flutter build web      - uses: FirebaseExtended/action-hosting-deploy@v0        with:          repoToken: '${{ secrets.GITHUB_TOKEN }}'          firebaseServiceAccount: '${{ secrets.YOUR-FIREBASE-SERVICE-ACCOUNT-SECRET-NAME }}'          projectId: YOUR-PROJECT-ID

Additional Resources / Info

This workflow wouldn't be possible without the brilliant:

GitHub logo subosito / flutter-action

Flutter environment for use in actions. It works on Linux, Windows, and macOS.


Original Link: https://dev.to/mysticza/flutter-web-x-firebase-hosting-github-action-3fke

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To