Build release on Windows #10
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build release on Windows | |
| on: | |
| workflow_dispatch: | |
| jobs: | |
| build: | |
| runs-on: windows-latest | |
| strategy: | |
| matrix: | |
| configuration: [Debug, Release] | |
| platform: [x64, x86] | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Add msbuild to PATH | |
| uses: microsoft/setup-msbuild@v3 | |
| with: | |
| vs-version: '17.0' # VS 2022 | |
| msbuild-architecture: x64 | |
| - name: Build SDL3 | |
| run: msbuild ".\vendor\SDL3\VisualC\SDL.sln" /t:SDL3:Rebuild /p:Configuration=${{ matrix.configuration }} /p:Platform=${{ matrix.platform == 'x86' && 'Win32' || matrix.platform }} | |
| - name: Build solution | |
| run: msbuild ".\vc\InputFusion.sln" /t:"InputFusion:Rebuild;GameInput:Rebuild;XInput:Rebuild;DInput8:Rebuild;DInput:Rebuild;WinMM:Rebuild" /p:Configuration=${{ matrix.configuration }} /p:Platform=${{ matrix.platform }} | |
| - name: Upload build outputs | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| name: build-${{ matrix.configuration }}-${{ matrix.platform }} | |
| path: build/**/output/**/*.dll | |
| compression-level: 0 | |
| package: | |
| runs-on: windows-latest | |
| needs: build | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Download all build artifacts | |
| uses: actions/download-artifact@v8 | |
| with: | |
| pattern: build-* | |
| merge-multiple: true | |
| path: build | |
| - name: Install 7-Zip | |
| run: choco install 7zip -y | |
| - name: Create 7z Archive | |
| id: create-archive | |
| shell: powershell | |
| run: | | |
| $name = "${{ github.repository }}" -split '/' | Select-Object -Last 1 | |
| $archivePath = ".\build\$name.7z" | |
| $tmp = ".\build\release" | |
| Remove-Item $tmp -Recurse -Force -ErrorAction SilentlyContinue | |
| New-Item -ItemType Directory -Path $tmp | Out-Null | |
| # InputFusion | |
| New-Item -ItemType Directory -Path "$tmp\InputFusion" | Out-Null | |
| New-Item -ItemType Directory -Path "$tmp\InputFusion\x64" | Out-Null | |
| New-Item -ItemType Directory -Path "$tmp\InputFusion\x64\Debug" | Out-Null | |
| New-Item -ItemType Directory -Path "$tmp\InputFusion\x86" | Out-Null | |
| New-Item -ItemType Directory -Path "$tmp\InputFusion\x86\Debug" | Out-Null | |
| Copy-Item ".\build\InputFusion\output\x64\Release\InputFusion.dll" "$tmp\InputFusion\x64" -Force | |
| Copy-Item ".\build\InputFusion\output\x64\Release\InputFusion.dll" "$tmp\InputFusion\x64\InputFusion.asi" -Force | |
| Copy-Item ".\build\InputFusion\output\x64\Debug\InputFusion.dll" "$tmp\InputFusion\x64\Debug" -Force | |
| Copy-Item ".\build\InputFusion\output\x64\Debug\InputFusion.dll" "$tmp\InputFusion\x64\Debug\InputFusion.asi" -Force | |
| Copy-Item ".\build\InputFusion\output\Win32\Release\InputFusion.dll" "$tmp\InputFusion\x86" -Force | |
| Copy-Item ".\build\InputFusion\output\Win32\Release\InputFusion.dll" "$tmp\InputFusion\x86\InputFusion.asi" -Force | |
| Copy-Item ".\build\InputFusion\output\Win32\Debug\InputFusion.dll" "$tmp\InputFusion\x86\Debug" -Force | |
| Copy-Item ".\build\InputFusion\output\Win32\Debug\InputFusion.dll" "$tmp\InputFusion\x86\Debug\InputFusion.asi" -Force | |
| # GameInput | |
| New-Item -ItemType Directory -Path "$tmp\GameInput" | Out-Null | |
| New-Item -ItemType Directory -Path "$tmp\GameInput\x64" | Out-Null | |
| New-Item -ItemType Directory -Path "$tmp\GameInput\x64\Debug" | Out-Null | |
| New-Item -ItemType Directory -Path "$tmp\GameInput\x86" | Out-Null | |
| New-Item -ItemType Directory -Path "$tmp\GameInput\x86\Debug" | Out-Null | |
| Copy-Item ".\build\GameInput\output\x64\Release\gameinput.dll" "$tmp\GameInput\x64" -Force | |
| Copy-Item ".\build\GameInput\output\x64\Debug\gameinput.dll" "$tmp\GameInput\x64\Debug" -Force | |
| Copy-Item ".\build\GameInput\output\Win32\Release\gameinput.dll" "$tmp\GameInput\x86" -Force | |
| Copy-Item ".\build\GameInput\output\Win32\Debug\gameinput.dll" "$tmp\GameInput\x86\Debug" -Force | |
| # XInput | |
| New-Item -ItemType Directory -Path "$tmp\XInput" | Out-Null | |
| New-Item -ItemType Directory -Path "$tmp\XInput\x64" | Out-Null | |
| New-Item -ItemType Directory -Path "$tmp\XInput\x64\Debug" | Out-Null | |
| New-Item -ItemType Directory -Path "$tmp\XInput\x86" | Out-Null | |
| New-Item -ItemType Directory -Path "$tmp\XInput\x86\Debug" | Out-Null | |
| Copy-Item ".\build\XInput\output\x64\Release\xinput1_4.dll" "$tmp\XInput\x64\xinput9_1_0.dll" -Force | |
| Copy-Item ".\build\XInput\output\x64\Release\xinput1_4.dll" "$tmp\XInput\x64\xinput1_3.dll" -Force | |
| Copy-Item ".\build\XInput\output\x64\Release\xinput1_4.dll" "$tmp\XInput\x64\xinput1_4.dll" -Force | |
| Copy-Item ".\build\XInput\output\x64\Debug\xinput1_4.dll" "$tmp\XInput\x64\Debug\xinput9_1_0.dll" -Force | |
| Copy-Item ".\build\XInput\output\x64\Debug\xinput1_4.dll" "$tmp\XInput\x64\Debug\xinput1_3.dll" -Force | |
| Copy-Item ".\build\XInput\output\x64\Debug\xinput1_4.dll" "$tmp\XInput\x64\Debug\xinput1_4.dll" -Force | |
| Copy-Item ".\build\XInput\output\Win32\Release\xinput1_4.dll" "$tmp\XInput\x86\xinput9_1_0.dll" -Force | |
| Copy-Item ".\build\XInput\output\Win32\Release\xinput1_4.dll" "$tmp\XInput\x86\xinput1_3.dll" -Force | |
| Copy-Item ".\build\XInput\output\Win32\Release\xinput1_4.dll" "$tmp\XInput\x86\xinput1_4.dll" -Force | |
| Copy-Item ".\build\XInput\output\Win32\Debug\xinput1_4.dll" "$tmp\XInput\x86\Debug\xinput9_1_0.dll" -Force | |
| Copy-Item ".\build\XInput\output\Win32\Debug\xinput1_4.dll" "$tmp\XInput\x86\Debug\xinput1_3.dll" -Force | |
| Copy-Item ".\build\XInput\output\Win32\Debug\xinput1_4.dll" "$tmp\XInput\x86\Debug\xinput1_4.dll" -Force | |
| # DInput 8 | |
| New-Item -ItemType Directory -Path "$tmp\DInput8" | Out-Null | |
| New-Item -ItemType Directory -Path "$tmp\DInput8\x64" | Out-Null | |
| New-Item -ItemType Directory -Path "$tmp\DInput8\x64\Debug" | Out-Null | |
| New-Item -ItemType Directory -Path "$tmp\DInput8\x86" | Out-Null | |
| New-Item -ItemType Directory -Path "$tmp\DInput8\x86\Debug" | Out-Null | |
| Copy-Item ".\build\DInput8\output\x64\Release\dinput8.dll" "$tmp\DInput8\x64" -Force | |
| Copy-Item ".\build\DInput8\output\x64\Debug\dinput8.dll" "$tmp\DInput8\x64\Debug" -Force | |
| Copy-Item ".\build\DInput8\output\Win32\Release\dinput8.dll" "$tmp\DInput8\x86" -Force | |
| Copy-Item ".\build\DInput8\output\Win32\Debug\dinput8.dll" "$tmp\DInput8\x86\Debug" -Force | |
| # DInput 1-7 | |
| New-Item -ItemType Directory -Path "$tmp\DInput 1-7" | Out-Null | |
| New-Item -ItemType Directory -Path "$tmp\DInput 1-7\x64" | Out-Null | |
| New-Item -ItemType Directory -Path "$tmp\DInput 1-7\x64\Debug" | Out-Null | |
| New-Item -ItemType Directory -Path "$tmp\DInput 1-7\x86" | Out-Null | |
| New-Item -ItemType Directory -Path "$tmp\DInput 1-7\x86\Debug" | Out-Null | |
| Copy-Item ".\build\DInput\output\x64\Release\dinput.dll" "$tmp\DInput 1-7\x64" -Force | |
| Copy-Item ".\build\DInput\output\x64\Debug\dinput.dll" "$tmp\DInput 1-7\x64\Debug" -Force | |
| Copy-Item ".\build\DInput\output\Win32\Release\dinput.dll" "$tmp\DInput 1-7\x86" -Force | |
| Copy-Item ".\build\DInput\output\Win32\Debug\dinput.dll" "$tmp\DInput 1-7\x86\Debug" -Force | |
| # WinMM | |
| New-Item -ItemType Directory -Path "$tmp\WinMM" | Out-Null | |
| New-Item -ItemType Directory -Path "$tmp\WinMM\x64" | Out-Null | |
| New-Item -ItemType Directory -Path "$tmp\WinMM\x64\Debug" | Out-Null | |
| New-Item -ItemType Directory -Path "$tmp\WinMM\x86" | Out-Null | |
| New-Item -ItemType Directory -Path "$tmp\WinMM\x86\Debug" | Out-Null | |
| Copy-Item ".\build\WinMM\output\x64\Release\winmm.dll" "$tmp\WinMM\x64" -Force | |
| Copy-Item ".\build\WinMM\output\x64\Debug\winmm.dll" "$tmp\WinMM\x64\Debug" -Force | |
| Copy-Item ".\build\WinMM\output\Win32\Release\winmm.dll" "$tmp\WinMM\x86" -Force | |
| Copy-Item ".\build\WinMM\output\Win32\Debug\winmm.dll" "$tmp\WinMM\x86\Debug" -Force | |
| # Misc | |
| Copy-Item ".\README.md" $tmp -Force | |
| Copy-Item ".\LICENSE" $tmp -Force | |
| & "C:\Program Files\7-Zip\7z.exe" a $archivePath "$tmp\*" | |
| Remove-Item $tmp -Recurse -Force | |
| Write-Output "filepath=$archivePath" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 | |
| - name: Upload release | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| name: release | |
| path: ${{ steps.create-archive.outputs.filepath }} | |
| compression-level: 0 |