# This workflow will build a .NET project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net

name: LANCommander Playnite Plugin

on:
  push:
    paths:
      - 'LANCommander.Playnite.Extension/**'
      - 'LANCommander.SDK/**'
  pull_request:
    paths:
      - 'LANCommander.Playnite.Extension/**'
      - 'LANCommander.SDK/**'
  workflow_dispatch:

jobs:
  build:

    runs-on: windows-latest

    steps:
    - uses: actions/checkout@v3
    - name: Setup MSBuild
      uses: microsoft/setup-msbuild@v1.3.1
    - name: Setup NuGet
      uses: NuGet/setup-nuget@v1.1.1
    - name: Restore NuGet packages
      run: nuget restore LANCommander.sln
    - name: Build and Publish Library
      run: msbuild LANCommander.Playnite.Extension/LANCommander.PlaynitePlugin.csproj /p:Configuration=Release /p:OutputPath=Build
    - name: Download Playnite Release
      uses: robinraju/release-downloader@v1.7
      with:
        repository: JosefNemec/Playnite
        tag: 10.13
        fileName: Playnite1013.zip
    - name: Extract Playnite
      run: Expand-Archive -Path Playnite1013.zip -DestinationPath Playnite
    - name: Run Playnite Toolbox
      run: Playnite/Toolbox.exe pack LANCommander.Playnite.Extension/Build .
    - name: Upload Artifact
      uses: actions/upload-artifact@v3.1.2
      with:
        path: LANCommander.PlaynitePlugin_48e1bac7-e0a0-45d7-ba83-36f5e9e959fc_1_0.pext
