Flutter - Building and Releasing APK using GitHub Actions
Last Updated :
23 Jul, 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
Flutter Tutorial This Flutter Tutorial is specifically designed for beginners and experienced professionals. It covers both the basics and advanced concepts of the Flutter framework.Flutter is Googleâs mobile SDK that builds native Android and iOS apps from a single codebase. It was developed in December 2017. When
7 min read
MVC Framework Introduction Over the last few years, websites have shifted from simple HTML pages with a bit of CSS to incredibly complex applications with thousands of developers working on them at the same time. To work with these complex web applications developers use different design patterns to lay out their projects, to
6 min read
Git Tutorial Git is an essential tool for developers, enabling them to manage and track project changes. Whether you're working on a solo project or collaborating with a team, Git keeps everything organized and under control. This Git Tutorial, from beginner to advanced, will give you a complete understanding of
13 min read
Best Way to Master Spring Boot â A Complete Roadmap In the corporate world, they say "Java is immortal!". But Why? Java remains one of the major platforms for developing enterprise applications. Enterprise Applications are used by large companies to make money. Those applications have high-reliability requirements and an enormous codebase. According
14 min read
Git Cheat Sheet The Git Cheat Sheet is a quick, well-organized guide designed for both beginners and experienced developers/DevOps engineers. It serves as a go-to reference for learning and recalling essential Git concepts and commands. In this Git Cheat Sheet, we have covered all the basics to advanced Git command
9 min read
Spring Boot - Architecture Spring Boot is built on top of the core Spring framework. It simplifies and automates Spring-based application development by reducing the need for manual configuration. Spring Boot follows a layered architecture, where each layer interacts with other layers in a hierarchical order. The official Spr
3 min read
Bash Scripting - If Statement Bash is an interpreter for command languages. It is a default command interpreter on most GNU/Linux systems and is widely available on various operating systems. The name is an abbreviation for Bourne-Again SHell. Scripting enables for the execution of instructions that would otherwise be executed o
15 min read
How to Create a Shell Script in linux Shell is an interface of the operating system. It accepts commands from users and interprets them to the operating system. If you want to run a bunch of commands together, you can do so by creating a shell script. Shell scripts are very useful if you need to do a task routinely, like taking a backup
7 min read
Spring Boot Actuator Developing and managing an application are the two most important aspects of the applicationâs life cycle. It is very important to know what is going on beneath the application. Also, when we push the application into production, managing it gradually becomes critically important. Therefore, it is a
5 min read
Test Plan - Software Testing Software testing is important to make sure applications work properly and meet user needs. A clear and detailed test plan is the foundation of successful testing, guiding everything from creating test cases to fixing issues. In this article, we will break down what a test plan is, why itâs important
15+ min read