name: MSBuild

on:
  pull_request:
    paths-ignore:
      - '**/README.md'

env:
  SOLUTION_FILE_PATH: CP_Main_10.sln

jobs:
  build:
    runs-on: windows-latest

    steps:
      - uses: actions/checkout@v4
                  
      - name: Add MSBuild to PATH
        uses: microsoft/setup-msbuild@v2

      - name: Restore NuGet packages
        working-directory: ${{env.GITHUB_WORKSPACE}}
        run: nuget restore ${{env.SOLUTION_FILE_PATH}}
        
      - name: Build 64bit
        run: msbuild CP_Main_10.sln /p:Configuration=Release /p:Platform=x64
        
      - name: Set Versions
        run: |
            DittoSetup\rcedit-x64 Release64\Ditto.exe --set-file-version ${{env.VERSION_DOT_FILENAME}} --set-product-version ${{env.VERSION_DOT_FILENAME}}

      - name: Installer
        uses: Minionguyjpro/Inno-Setup-Action@v1.2.7
        with:
          path: DittoSetup\DittoSetup_10.iss
          options: /F"DittoSetup_${{env.VERSION_FILENAME}}" "/dbit64=1"