Flutter - Building and Releasing APK using GitHub Actions
Last Updated :
09 Apr, 2025
Github Actions is a Github tool that allows users to create CI/CD pipelines directly in a Github project instead of going to a third-party website. It assists us in developing, testing, and releasing our project very conveniently. In this article, we're going to build a workflow for our Flutter project. We'll first build the project using the workflow and then release the APK under the artifacts section of Github Actions.
Prerequisites: Basic understanding of Github Actions and writing Workflows using Github Actions.
So now, as we have the basic understanding of how to write a workflow, let's first create a Github project in flutter and create a .yml file named flutter-workflow.yml in .github/workflows/ directory under the project's root directory. Start writing the code in that file.
XML
name: Flutter CI
on:
push:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/setup-java@v1
with:
java-version: '12.x'
- uses: subosito/flutter-action@v1
with:
channel: 'beta'
- run: flutter pub get
- run: flutter format --set-exit-if-changed .
- run: flutter analyze .
- run: flutter build apk
- uses: actions/upload-artifact@v1
with:
name: release-apk
path: build/app/outputs/apk/release/app-release.apk
First of all, we give a name to our workflow, here, the name is Flutter CI. Every workflow should have an 'on' bloc,k which commands the workflow to get triggered as soon as the action defined in that block is reached. In our case, we have specified that wherever there will be a new push in the master branch, the workflow will get triggered. Jobs are the crucial part of a workflow, which will have details about the tasks that have to be done. Here we have specified only one job which is build. Every build has to go through a setup of the virtual environment, which is specified in the runs-on section. Here, we are using the Github-hosted ubuntu-latest.
Now comes the steps section, in which we define the steps that will be executed when the workflow gets triggered. For building our code, we have to first checkout to our repository by writing actions/checkout@v1.
The next step would involve setting up of java by actions/setup-java@v1. As we set up the java, we have to set up flutter too to build our app. Hence, we define subosito/flutter-action@v1. When we have set up Java and Flutter, we have to get the dependencies of Flutter to build the project. So we define flutter pub get. Once we get the dependencies, we format our code, flutter format --set-exit-if-changed. Flutter analyze. Runs the static analysis of our code.
Now comes the main part to build the apk and upload the APK to the artifacts section. For that, we say flutter build apk and upload the APK using actions/upload-artifact@v1 from the directory build/app/outputs/apk/release/app-release.apk to the Artifacts section of our project. After writing the code, commit it by giving a message and go to the Actions tab to see the workflow running.

After the build that is running gets completed, click again on the Actions tab and then click on the latest workflow that just completed running. Scroll to the bottom of the page, and you'll see an apk named release-apk in the artifacts section.

In this way, we created a workflow that will let you build the artifacts every time there is a new push in the main codebase i.e. master branch, and upload the newly build APK to the artifacts section of Github Actions.
Similar Reads
Automated Release for Android Using GitHub Actions
Automating the release process for Android applications can significantly enhance efficiency, reduce manual errors, and ensure consistent delivery. GitHub Actions provides a powerful platform to automate workflows directly from your GitHub repository. This article will guide you through setting up a
3 min read
How to Build Music Player Application Using Flutter?
Music can inspire and motivate us, it makes every person feel enthusiastic and relaxed. In this article, we will explain how to build a Music Player application step by step with some basic functionalities like pause, play, and seek in Flutter from a music URL. Flutter is an open-source framework de
6 min read
Flutter - Build Language Learning App
In this article, we will explore how to create a language-learning app using Flutter, a popular open-source UI software development toolkit developed by Google. Flutter enables developers to build natively compiled applications for mobile, web, and desktop platforms from a single codebase. This make
13 min read
Basic CI Workflow For Android using GitHub Actions
Continuous integration (CI) is a software development process in which the team members can integrate their work. For Android developers, setting up a CI pipeline can greatly enhance productivity and code quality. GitHub Actions, a powerful automation tool integrated into GitHub, provides an excelle
2 min read
REST API Endpoints For GitHub Actions Variables
GitHub Actions is used to automate workflows, build, test, and deploy code. To make workflows more dynamic and secure, GitHub Actions allows you to use variables, which can store data like configuration values, secrets, or other necessary information. GitHub exposes a REST API to manage these variab
5 min read
How to Build Advance Quiz App in Flutter?
This is a quiz app using Flutter and API. The working of this application is very simple, Â here we have two screens: screen one and screen two. Screen one is the stateless screen which means that it will not respond to any change on the screen. The second screen, is a stateful widget which means tha
9 min read
GitHub App to Build Form using Typeform and Probot
GitHub is a cloud-based software development website that uses Git as version control. Github is the brand ambassador of open source software development and gives developers the ability to collaborate on software development and host the source code as well. The code is hosted as the content of a r
7 min read
How to Build and Release Flutter Application in Android Device?
Flutter is Googleâs Mobile SDK to build native iOS and Android, Desktop (Windows, Linux, macOS), Web apps from a single codebase. When building applications with Flutter everything towards Widgets â the blocks with which the flutter apps are built. They are structural elements that ship with a bunch
2 min read
Spring Boot - Continuous Integration Using GitHub Actions
Let's say we have two or more developers who are merging code into a single repository. There can be issues in merging code from different developers. So the Continuous Integration tools help in solving not just that but many other things like: Run an automated build after successful merging (like b
3 min read
Flutter - Add Quick Actions Button
Quick actions for your launcher screen so that your users can access commonly used functions, such as opening a particular screen, transferring records or using a template in the mobile app, etc. Also called as App Shortcuts(in Android) and Home Screen Actions(in iOS) which allow users to perform ce
7 min read