name: Build MacOS and iOS

on:
  push:
    branches:
      - devel
  pull_request:
    branches:
      - devel

jobs:
  build:
    runs-on: macos-latest

    steps:
    - name: Checkout code
      uses: actions/checkout@v2

    - name: Install Flutter
      uses: subosito/flutter-action@v2
      with:
        channel: 'stable'
        flutter-version: '3.24.1'

    - name: disable analytics
      run: flutter config --no-analytics

    - name: Install dependencies
      run: flutter pub get

    - name: Build for MacOS
      run: flutter build macos

    - name: Build for iOS
      run: flutter build ios --release --no-codesign


    - name: Gather macos artifacts
      uses: actions/upload-artifact@v4
      with:
        name: flutter-macos-build-latest
        path: build/macos/Build/Products
        if-no-files-found: error

    - name: Gather ios artifacts
      uses: actions/upload-artifact@v4
      with:
        name: flutter-ios-build-latest
        path: build/ios/iphoneos
        if-no-files-found: error
