This repository provides a streamlined CI/CD workflow for building Flutter APKs, uploading them to Google Drive, sending the download link to a Telegram channel, and sending a notification email to a Gmail account. It automates the tedious tasks involved in the build and distribution process, saving you time and effort.
The workflow defined in this repository performs the following steps:
- On every push to the
master
ortest
branch, the workflow is triggered. - The workflow checks out the repository and retrieves relevant information such as the branch name, project name, commit author, commit author email, and commit author date.
- The Flutter environment is set up, including Java and Flutter versions.
- The build process begins by cleaning the build folder and fetching package dependencies.
- The script builds the APK in release mode without tree-shaking the icons.
- The workflow obtains the appropriate Google Drive folder ID based on the branch name.
- The files are archived and uploaded to Google Drive, specifying the folder ID and a unique name based on the branch and timestamp.
- A notification is sent to the specified Telegram channel, providing details about the build and a link to download the APK from Google Drive.
- An email notification is sent to the specified Gmail account, including the project, branch, and date details, along with the Google Drive download link.
To use this CI/CD workflow for your Flutter project, follow these steps:
- Fork this repository or create a new repository based on this template.
- Configure the necessary secrets in your repository settings:
MASTER_FOLDER_ID
: Google Drive folder ID for themaster
branch.TEST_FOLDER_ID
: Google Drive folder ID for thetest
branch.GOOGLE_DRIVE_CREDENTIALS
: Service account credentials JSON for Google Drive access.TELEGRAM_CHANNEL_ID
: Telegram channel ID for sending notifications get it here.TELEGRAM_TO
: Comma-separated list of Telegram user IDs or usernames to send notifications to get it here.TELEGRAM_BOT_TOKEN
: Telegram bot token for sending notifications get it here.GMAIL_USERNAME
: Gmail account username for sending notification emails.GMAIL_PASSWORD
: Gmail account password or an app-specific password for sending notification emails.
- Customize the email notification's content in the
Notify Gmail
step to match your requirements. - Commit and push your changes to trigger the CI/CD workflow.
That's it! Now, whenever there's a push to the master
or test
branch, the workflow will automatically build the APK, upload it to Google Drive, send the link to the Telegram channel, and send a notification email to the specified Gmail account.
Feel free to customize and enhance the workflow to suit your specific needs.
- Ensure that you have the necessary permissions and access to the Google Drive folders, Telegram channel, and Gmail account.
- Make sure to keep your secrets secure and avoid exposing them in public repositories.
- If you have any questions or suggestions, don't hesitate to send me.