Flutterexperts

Empowering Vision with FlutterExperts' Expertise
Automation Flutter with GitHub Actions & Firebase App Distribution

In this article, we will talk about GitHub Actions, Firebase App Distribution, and Flutter. This article will reveal to you a perfect technique to oversee, sending another grouping of your Flutter application to your customer with GitHub Actions and Firebase App Distribution.

Flutter :

Flutter is Google’s UI toolkit for building beautiful, natively compiled applications for mobileweb, and desktop from a single codebase. Please visit flutter.dev for more info about it.

  • To begin with, you’ll need fundamental information on Flutter, Git, and GitHub. If you are new to flutter you can get started by reading the official documentation on flutter.dev

Flutter — Beautiful native apps in record time
Flutter is Google’s UI toolkit for crafting beautiful, natively compiled applications for mobile, web, and desktop from…flutter.dev

Firebase App Distribution :

Firebase App Distribution makes it easy to distribute pre-release apps to testers so that you can get feedback from the early users quickly. It can also be combined with Crashlytics, which will give you reports about any crash that occurs on the tester’s device.

It likewise permits you to share your new application release with groups of testers as fast as sending an email! Not any more trusting those days for it will be approved on the Google Play Store. The reasons we use Firebase App Distribution are because it’s allowed to utilize, simple to set up, a “set and forget” process, and, above all, simple for your customer to utilize. As we probably are aware, customers frequently have next to no or no technical background, and you would prefer not to send them apk files manually.

We should utilize Firebase App Distribution in a current task:

  • Assemble an apk from your Flutter project by running flutter build apk in the command line.
  • Open your Firebase console and explore to App Distribution and then next Get started and then next Testers and Groups.
  • We should include a gathering called “testers,” and include your email as a tester to the gathering.
  • Presently switch back to the “Releases” tab and upload your application.
  • Include the gathering “testers” as testers and adhere to the guidelines.
  • The last step is to browse your email and adhere to the guidelines.

Presently you have an approach to send your apk to a gathering of analyzers; however, it should be done manually, and we are software engineers, so we should computerize it!

GitHub Actions :

Github Actions assist you with mechanizing your software development workflows in a similar spot you store code and team up on pull requests and issues. You can compose singular tasks, called actions, and join them to make a custom workflow. It contains most highlights than other CI/CDs like Travis or CircleCI have. The speed of Github Actions is acceptable, and its pricing is better than that of Travis.

It is a CI/CD automation tool built into your GitHub workflow. It permits you, for instance, to send automated messages to new givers in your repo, or test your application before releasing it to creation. It’s free for public repositories, and some free computing minutes per month are included for private repositories. See GitHub Pricing additional details.

We make an action that attempts to build your application on each commit or pull request. We make another branch “dev,” and each time we push from “dev” to “master,” GitHub builds your application and tells you on the off chance that it comes up short. The catch here is that we have some secret files that we would prefer not to transfer to GitHub. These files are listed in the .gitignore file. So first, we have to scramble the secret files and, at exactly that point, transfer them to GitHub and give GitHub the keys to unscramble them. Let’s proceed to the workflow.

Workflow File :

The main thing you need to do is make a .yml file, which is an arrangement record that Github Action can comprehend.

You should store work process records in the .github/workflows /directory in your repository. You can name the file anything you desire for this instructional name. ci.yml.

.github/workflows/ci.yml

#on

Github Actions will execute the workflow following the events under the key. In this example, we need to run it just when we push to master branch, yet you can include any of your favored branches.

https://gist.github.com/ShaiqAhmedkhan/3c7f657bd7fce873e3dd14ec0311f429#file-github_action_1-yml

#job

A workflow run is comprised of at least one job. For our example, we need just one job.

#runs-on

The sort of virtual host machine to run the activity on. For our case, we need ubuntu-latest.

Each ubuntu host machine contains different installed software. You can check a list of supported software, tools, and packages in each virtual environment here.

https://gist.github.com/ShaiqAhmedkhan/14df9be696c249d3fc1c3dadeeb648b0#file-github_action_2-yml

  • Set up the Flutter environment for Github Actions.

https://gist.github.com/ShaiqAhmedkhan/899e2076d29366c35490403aa9bc2dd5#file-github_action_3-yml

  • Write the command to get the Flutter dependencies.
- run: flutter pub get
  • Check for any format issues in the code.
- run: flutter format --set-exit-if-changed .
  • Analyze the Dart code for errors.
- run: flutter analyze .
  • Run widget tests for our project.
- run: flutter test
  • Build an APK.
- run: flutter build apk
  • Add the following to the main.yml file:

https://gist.github.com/ShaiqAhmedkhan/96b30c462914b167912974eb7158b0f3#file-main-yml

Presently what’s left is to push to GitHub and check if the activity passes. It may take some time for the move to run. You can see the progress by going to the GitHub “Activities” tab.

Firebase App Distribution with GitHub Actions :

Now we have all the components working and tested. The last step is to combine them. We expand the current GitHub Action so that, on a pull request to the “master” branch, it transfers the new version of the application to Firebase App Distribution.https://tenor.com/embed/12458983

To begin with, we have to give GitHub Actions authentication data and authorizations to your Firebase account.

  • Make a Firebase token by runningfirebase login:ci in the command line.
  • Open GitHub and go to the repository.
  • Explore to Settings, open the Secrets, and then Add Secret.
  • Enter “FIREBASE_TOKEN” as the name, and the token made in sync One as the value.
  • Go to the settings in your firebase console and copy the App ID.
  • Add it as a secret to GitHub with “FIREBASE_ANDROID_APPID” as the name, and the ID as the value.

All that’s left is to update the GitHub Action. You can do this in the “dev” branch and then push your changes to GitHub.

- name: Firebase App Distribution
uses: wzieba/Firebase-Distribution-Github-Action@v1.2.1
with:
appId: ${{secrets.FIREBASE_APP_ID}}
token: ${{secrets.FIREBASE_TOKEN}}
groups: testers
file: app/build/outputs/apk/release/app-release-unsigned.apk

Make a pull request from “dev” to “master,” and you can see the state of the action in the pull request. After it completes, you ought to get an email from Firebase with the new version of the application. Since you realize it works, add the client’s email to the testers group in Firebase App Distribution, so they get an email whenever the activity runs.

Conclusion:

This article would serve as an Exploratory article for Automation Flutter with GitHub Actions & Firebase App Distribution and its working using Flutter.

I hope this blog has provided you with valuable information about what is all about Automation Flutter with GitHub Actions & Firebase App Distribution, and that you will give it Automation Flutter with GitHub Actions & Firebase App Distribution — a Try. Begin using your apps.

Thanks for reading this article ❤

If I got something wrong? Let me know in the comments. I would love to improve.

Clap 👏 If this article helps you.


Feel free to connect with us:
And read more articles from FlutterDevs.com.

FlutterDevs team of Flutter developers to build high-quality and functionally-rich apps. Hire a flutter developer for your cross-platform Flutter mobile app project on an hourly or full-time basis as per your requirement! You can connect with us on FacebookGitHubTwitter, and LinkedIn for any flutter-related queries.

We welcome feedback and hope that you share what you’re working on using #FlutterDevs. We truly enjoy seeing how you use Flutter to build beautiful, interactive web experiences.


Leave comment

Your email address will not be published. Required fields are marked with *.