name: Build Windows

on:
  push:
    branches: [ main, master ]
  pull_request:
    branches: [ main, master ]
  workflow_dispatch:

jobs:
  build:
    runs-on: windows-latest

    steps:
    - uses: actions/checkout@v3
    
    - name: Setup Flutter
      uses: subosito/flutter-action@v2
      with:
        flutter-version: '3.24.0'
        channel: 'stable'
    
    - name: Enable Windows desktop
      run: flutter config --enable-windows-desktop
    
    - name: Get dependencies
      run: flutter pub get
    
    - name: Build Windows Debug
      run: flutter build windows
    
    - name: Build Windows Release
      run: flutter build windows --release
    
    - name: Upload Debug build artifacts
      uses: actions/upload-artifact@v3
      with:
        name: windows-debug-build
        path: build/windows/runner/Debug/
    
    - name: Upload Release build artifacts
      uses: actions/upload-artifact@v3
      with:
        name: windows-release-build
        path: build/windows/runner/Release/
