on:
  push:
    branches: [ "main" ]
  pull_request:
    branches: [ "main" ]
    types: [ "review_requested", "ready_for_review" ]
  workflow_dispatch:
name: WinUI
jobs:
  gnome-flatpak:
    name: "WinUI on Windows"
    runs-on: windows-latest
    if: ${{ github.event.pull_request.user.login != 'weblate' }}
    strategy:
      matrix:
        configuration: [Debug] #release doesn't work for some reason
        platform: [x64, arm64]
    env:
      Project_Path: NickvisionTagger.WinUI/NickvisionTagger.WinUI.csproj
    steps:
      - uses: actions/checkout@v3.5.0
        with:
          submodules: recursive
      # Install the .NET Core workload
      - name: Install .NET Core
        uses: actions/setup-dotnet@v3.2.0
        with:
          dotnet-version: 8.0.x
      # Add  MSBuild to the PATH: https://github.com/microsoft/setup-msbuild
      - name: Setup MSBuild.exe
        uses: microsoft/setup-msbuild@v1.3.1
      # Restore the application to populate the obj folder with RuntimeIdentifiers
      - name: Restore the application
        run: msbuild $env:Project_Path /t:Restore /p:Configuration=$env:Configuration
        env:
          Configuration: ${{ matrix.configuration }}
      # Build the app
      - name: Build the application
        run: msbuild $env:Project_Path /p:Configuration=$env:Configuration /p:Platform=$env:Platform
        env:
          Configuration: ${{ matrix.configuration }}
          Platform: ${{ matrix.platform }}
      # Upload the app
      - name: Upload app
        uses: actions/upload-artifact@v3.1.2
        with:
          name: org.nickvision.tagger-winui-${{ matrix.platform }}
          path: ${{ github.workspace }}\NickvisionTagger.WinUI\bin\${{ matrix.platform }}\Debug\net8.0-windows10.0.19041.0