Setup Workflow To Build And Release Apps
-
Flutterflow Push Code To The GIthub Acoount
-
Git actions should get triggered
a. build apk
b. release apk
Note : Before using git actions compile flutter code on local environment for any errors.
Note : Workflow is Working In only Main Branch.To Merge Flutterflow branch with main branch Create new Pull Request and merge with main branch.
Go to Pull Requests--->New Pull Request
Set Base Branch as MAIN and Compare branch as FLUTTERFLOW------>Create New Pull Request
Merging Changes/Pull Request
Navigate to your repo on GitHub, and select the Actions tab.
In the actions tab we can see that there is the option to set up the workflow from scratch by selecting the ‘Set up a workflow yourself’ link, or by leveraging one of the multiple templates provided. It is these templates that make building these workflow simple.
By clicking on one of the options, we are sent to the console editor where we can begin building our workflow.
The first thing you have to do is create a .yml file, which is a configuration file that Github Action can understand. You must store workflow files in the .github/workflows/ directory in your repository. You can name the file whatever you want, for this tutorial name it flutter-ci.yml. .github/workflows/flutter-ci.yml
Github Actions will execute the workflow following the events under on key. In this example, we want to run it only when we push to master branch but you can add any of your preferred branches.
A workflow run is made up of one or more jobs. For our example, we need only one job.
The type of virtual host machine to run the job 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.
A job contains a sequence of tasks called steps. You can have a granular step that runs only one command or a multi-line with a sequence of tasks pack together. Let’s go through a series of steps in order to meet our requirements.
- We have to set up the Flutter environment for the Github Actions and for that we will be using subosito/flutter-action .
- Write the command to get the Flutter dependencies.
- run: flutter pub get
- Check for any formatting issues in the code.
- run: flutter format --set-exit-if-changed .
- Statically analyze the Dart code for any errors.
- run: flutter analyze .
- Run widget tests for our flutter project.
- run: flutter test
- Build an Android APK.
- run: flutter build apk
- Finally, upload our generated app-release.apk for our workflow to the artifacts. For this, we will be using actions/upload-artifact .
**You Can Find Sample Workflow File Here :
-
Go to your Repository
-
On right side of Screen Releases Section
-
You can find Your Releases here
**If You Encounter Any Errors Here Are Some Useful Resources :
Desktop support allows you to compile Flutter source code to a native Windows, macOS, or Linux desktop app. Flutter’s desktop support also extends to plugins—you can install existing plugins that support the Windows, macOS, or Linux platforms, or you can create your own.
for windows platform (same commands can be used for Linux and MacOs plantforms)
Enable Platform Support
flutter config --enable-windows-desktop
Create Plantform Dependant Runners
flutter create --platforms=windows,macos,linux .
Build Release
flutter build windows
For Windows Builds ,
<project root folder>/build/windows/runner/release
For Linux Builds ,
<project root folder>/flutter_navigate2.0/build/linux/x64/release/bundle
Click Here To Know More : https://docs.flutter.dev/desktop