|
| 1 | +name: Build and Release for Windows |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - 'v*' |
| 7 | + workflow_dispatch: |
| 8 | + |
| 9 | +jobs: |
| 10 | + build-windows: |
| 11 | + runs-on: windows-latest |
| 12 | + |
| 13 | + steps: |
| 14 | + - name: Checkout code |
| 15 | + uses: actions/checkout@v4 |
| 16 | + |
| 17 | + - name: Install dependencies |
| 18 | + run: | |
| 19 | + # Install SFML via vcpkg |
| 20 | + git clone https://github.com/Microsoft/vcpkg.git |
| 21 | + cd vcpkg |
| 22 | + .\bootstrap-vcpkg.bat |
| 23 | + .\vcpkg install sfml:x64-windows |
| 24 | + |
| 25 | + - name: Create build directory |
| 26 | + run: mkdir build |
| 27 | + |
| 28 | + - name: Configure CMake |
| 29 | + run: | |
| 30 | + cd build |
| 31 | + cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=../vcpkg/scripts/buildsystems/vcpkg.cmake |
| 32 | + |
| 33 | + - name: Build |
| 34 | + run: | |
| 35 | + cd build |
| 36 | + cmake --build . --config Release |
| 37 | + |
| 38 | + - name: Create release package |
| 39 | + run: | |
| 40 | + mkdir release-windows |
| 41 | + copy build\Release\Oubliette.exe release-windows\ |
| 42 | + xcopy src\assets release-windows\assets\ /E /I |
| 43 | + copy README.md release-windows\ |
| 44 | + |
| 45 | + # Copy SFML DLLs |
| 46 | + copy vcpkg\installed\x64-windows\bin\*.dll release-windows\ |
| 47 | + |
| 48 | + # Create a batch launcher |
| 49 | + echo @echo off > release-windows\run.bat |
| 50 | + echo cd /d "%%~dp0" >> release-windows\run.bat |
| 51 | + echo Oubliette.exe >> release-windows\run.bat |
| 52 | + |
| 53 | + - name: Create ZIP archive |
| 54 | + run: | |
| 55 | + cd release-windows |
| 56 | + powershell Compress-Archive -Path * -DestinationPath ..\Oubliette-Windows.zip |
| 57 | + |
| 58 | + - name: Upload release |
| 59 | + uses: actions/upload-artifact@v4 |
| 60 | + with: |
| 61 | + name: Oubliette-Windows |
| 62 | + path: Oubliette-Windows.zip |
| 63 | + |
| 64 | + - name: Create GitHub Release |
| 65 | + if: startsWith(github.ref, 'refs/tags/') |
| 66 | + uses: softprops/action-gh-release@v1 |
| 67 | + with: |
| 68 | + files: Oubliette-Windows.zip |
| 69 | + generate_release_notes: true |
| 70 | + env: |
| 71 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments