Skip to content

Merge pull request #24 from unstoppableayush/mob_app #5

Merge pull request #24 from unstoppableayush/mob_app

Merge pull request #24 from unstoppableayush/mob_app #5

name: Build Android APK and Email
on:
push:
branches:
- main
jobs:
build-and-email:
runs-on: ubuntu-latest
env:
GOOGLE_SERVICES_JSON: ${{ secrets.GOOGLE_SERVICES_JSON }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Java
uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: "17"
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
channel: "stable"
- name: Write google-services.json from secret
if: ${{ env.GOOGLE_SERVICES_JSON != '' }}
run: |
echo "$GOOGLE_SERVICES_JSON" | base64 -d > app/android/app/google-services.json
- name: Install dependencies
working-directory: app
run: flutter pub get
- name: Build release APK
working-directory: app
run: flutter build apk --release
- name: Email APK
uses: dawidd6/action-send-mail@v3
with:
server_address: ${{ secrets.SMTP_HOST }}
server_port: ${{ secrets.SMTP_PORT }}
username: ${{ secrets.SMTP_USERNAME }}
password: ${{ secrets.SMTP_PASSWORD }}
subject: "Speaking App - Release APK"
to: ${{ secrets.SMTP_TO }}
from: ${{ secrets.SMTP_FROM }}
body: "Attached is the latest release APK from the main branch build."
attachments: app/build/app/outputs/flutter-apk/app-release.apk