Flutter: code push to get APK on slack

Ankit Bavadiya
3 min readDec 30, 2021
Snapshot of codemagic site

In today’s tutorial, our hero is codemagic

Codemagic is designed with cross-platform app development in mind and is voted the best CI/CD tool in Flutter’s user survey. Configure your Flutter builds in the UI or by using the highly customizable codemagic.yaml file, and build apps for Android, iOS, the web, and desktop.

How Codemagic works

  • Add your app wherever it is hosted
  • Start the build
  • Test automatically
  • Get notifications and feedback
  • Automate deployment
  1. Add your app wherever it is hosted

Codemagic CI/CD integrates with Azure DevOps, GitHub, GitLab, Bitbucket, and other self-hosted or cloud-based Git repositories.

After the login, we can see the dashboard. Click on Add your first app. Then select a Git provider or repository URL. Then select the repository and type of app so here we are select flutter.

2. Setup build configuration

Here are two ways to set up a build configuration

  • setup configuration from WebUI
  • setup using YAML code configuration

1. Select Build for platforms (Android and ios)
2. Select instance for Run build on (macOS Standard VM)
3. Select event for build triggers (Trigger on push)
4. Branch pattern as your project branch setup(dev or main) (* is default all)
5. Environment variable setup
6. Set Dependency caching (If your flutter app need)
7. Here test feature where we can add on our static test script(Not necessory). Also we can setup unit test and integration over here.
8. Select flutter app build configuration(Flutter version, Xcode version, CocoaPods version, Project path, Android build format, iOS build command, Mode, Build arguments)

Build configuration and setup snapshot

3. Distribution setup (Optional)

Here multiple distribution platforms are available where we can directly publish our app. Select your needed platforms and link your account with codemagic.

4. Notification setup on slack and email

Email notification is default enabled with your account mail and slack notification setup we need to enable. Hereafter the connect the slack workspace we’ve got an option for a select channel. Also, two types of notification are available to Notify when the build starts and Publish artifacts even if tests fail

Slack Notification snapshot

Snapshot when the build run start
After build complete

Conclusion

Codemagic is CI/CD solution made for Flutter, React Native, Native ios, Native android, Cordova, Ionic, Unity apps, that allows you to build, test, and publish apps with zero configuration. And don’t forget that you can also run builds in controlled environments using custom workflows.

--

--

Ankit Bavadiya

Backend developer, Actively working in ML and Chatbot development. DevOps is my practicing throughout life cycle of various project.