Last active
October 1, 2022 18:30
-
-
Save mahmoud-eslami/337a85bc2f81e5fdff4e7ee28f65e2cb to your computer and use it in GitHub Desktop.
GitHub actions workflow to build Flutter app.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Put this file under .github/workflows folder. | |
# You have to convert your key.jks and key.properties to base64 and then add them to the repository secrets . | |
# Command to conver files to base64 : base64 key.jks > key.jks.base64 | |
# Open key.jks.base64 and copy the base64 and then put in your repository secrets . | |
# If you want to recieve apk in telegram you have to create a telegram bot and then put | |
# the bot token and your uid of your account in the repository secrets . | |
# How get the uid of your telegram account : https://github.com/appleboy/telegram-action | |
name: Flutter CI/CD | |
on: | |
push: | |
branches: [ main ] | |
jobs: | |
build_android: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout the code | |
uses: actions/checkout@v1 | |
- name: Setup java to compile android project | |
uses: actions/setup-java@v1 | |
with: | |
java-version: "12.x" | |
- name: Install and set flutter version | |
uses: subosito/flutter-action@v2 | |
with: | |
flutter-version: "3.3.0" | |
channel: 'stable' | |
- name: Check dir | |
run: ls /home/runner/work | |
- name: Create the keystore | |
run: echo "${{ secrets.KEY }}" | base64 -d > /home/runner/work/my-financial/my-financial/android/key.jks | |
- name: Create the properties | |
run: echo "${{ secrets.PROPERTIES }}" | base64 -d > /home/runner/work/my-financial/my-financial/android/key.properties | |
- name: Get packages | |
run: flutter pub get | |
- name: Build android app | |
run: flutter build apk --release | |
- name: Rename app | |
run: cd build/app/outputs/apk/release/ && mv app-release.apk my_financial.apk | |
- name: Publish apk artefacts | |
uses: actions/upload-artifact@v1 | |
with: | |
name: release-apk | |
path: build/app/outputs/apk/release/app-release.apk | |
- name: Send release version on telegram | |
uses: appleboy/telegram-action@master | |
with: | |
to: ${{ secrets.USER_ID }} | |
token: ${{ secrets.TELEGRAM_TOKEN }} | |
message: | | |
${{ github.actor }} created commit: | |
Commit message: ${{ github.event.commits[0].message }} | |
Repository: ${{ github.repository }} | |
See changes: https://github.com/${{ github.repository }}/commit/${{github.sha}} | |
document: build/app/outputs/apk/release/app-release.apk |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment