name: "Frontend: Build"

on:
  workflow_dispatch:

  push:
    branches: [ "main" ]
    paths:
      - 'mobile/**'
  pull_request:
    branches: [ "main" ]
    paths:
      - 'mobile/**'

jobs:
  build:
    runs-on: ubuntu-latest
    defaults:
      run:
        working-directory: ./mobile
    steps:
      - name: Clone repository
        uses: actions/checkout@v4
      - name: Setup Flutter
        uses: subosito/flutter-action@v2
        id: flutter-action
        with:
          # channel: stable
          flutter-version: 3.29.2
      - name: Install Linux Dependencies
        run: sudo apt-get install -y ninja-build libgtk-3-dev
      - name: Turn off CLI animations
        run: flutter config --no-cli-animations
      - name: Install packages
        run: flutter pub get
      - name: Build Linux
        run: flutter build linux --verbose
      - name: Build Web
        run: flutter build web --verbose