Automate your Flutter build process with GitHub Actions.
Simply run this command in your project root directory to add the workflow file:
git clone https://github.com/nizwar/flutter-build-actions.git .github/workflows && rm -rf .github/workflows/.git
or Follow the steps below to add the workflow file manually.
- Create a new workflow file in your repository at
.github/workflows/flutter-build.yml
- Copy flutter-build.yml script from this repository into your workflow file
- Commit and push your workflow file to your repository
- It will start building your project automatically when you push a commit remotely
After the build is complete on the first time, setup your Github Pages to deploy the documentation, you can follow the steps below:
- Go to your repository settings
- Scroll down to Github Pages section (Left menu)
- On Build and deploy section, change Source to
Deploy from a branch
- Select
documentation
branch and/ (root)
folder - Click Save
- Wait for the Github Pages to be deployed (Go to action tab to see the progress)
The point of making dart documentation is to use ///
(3 slashes) to comments above every member and type.
Example:
/// Put here to describe of your function
///
/// To make new line, Make empty line between 2 lines
/// For checking, you can hover over the function to see the description
void yourFunction(String path) {
// To comment inside your function use 2 slashes
}
More details about dart documentation can be found here.
The workflow will run the following steps:
- Checkout the repository
- Setup SDK 12
- Initialize Project Version
- Install Flutter SDK
- Generate DartDoc
- Build APK & AAB
- Upload APK & AAB as Github Release
- Deploy Documentation to Github Pages
To see the progress of the workflow, go to the Actions tab in your repository.
The process will take about 10 minutes to complete (depends how big your project is). Once the build is complete, you will receive an email and you can download the APK's and AAB files from the release page.
If you want to manually trigger the workflow, simply change "push" to "workflow_dispatch" (LINE 2), and then trigger it by clicking the "Run workflow" button in the Actions tab.
Here is an example project that uses this workflow: Flutter Build Actions Example.
See the release page to download the APK and AAB files: Release Page
See the Github Pages to see the documentation: Github Pages
If you like this project, please give it a star and share it with your friends. You can also support me by buying me a coffee with PayPal