diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1bea5c6..1a1c0d7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -7,6 +7,31 @@ on: pull_request: jobs: + build-windows: + runs-on: windows-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Set up Qt5 on Windows + run: | + choco install qt5 -y + set PATH=%PATH%;C:\tools\qt5\bin # Ensure qmake is in the PATH + + - name: Set architecture for build + run: echo "Building for Windows x64 architecture" + + - name: Build application + run: | + .\build.bat windows-latest-x64-binary # Ensure your build.bat script exists and is configured for Windows + + - name: Upload binary + uses: actions/upload-artifact@v3 + with: + name: Hedgehog-windows-latest-x64-binary + path: Hedgehog-windows-latest-x64-binary + build-linux: runs-on: ubuntu-latest @@ -78,6 +103,12 @@ jobs: with: name: Hedgehog-macos-latest-arm64-binary path: ./ + + - name: Download Windows x64 binary + uses: actions/download-artifact@v3 + with: + name: Hedgehog-windows-latest-x64-binary + path: ./ - name: Create Draft Release id: create_release diff --git a/build.bat b/build.bat new file mode 100644 index 0000000..7c13692 --- /dev/null +++ b/build.bat @@ -0,0 +1,28 @@ +@echo off + +REM Function to replace destination binary path in Makefile (Windows equivalent) +setlocal +set "file=Makefile" +set "string_to_replace=Hedgehog.app\\Contents\\MacOS\\" +set "replacement_string=" + +REM Use PowerShell to replace the string +powershell -Command "(Get-Content %file%) -replace '%string_to_replace%', '%replacement_string%' | Set-Content %file%" +echo Replaced "%string_to_replace%" with "%replacement_string%" in "%file%". + +REM Clean previous builds +if exist build rmdir /S /Q build +mkdir build + +REM Run qmake and make +qmake +nmake + +REM Copy the final binary +if "%~1"=="" ( + copy "build\Hedgehog.exe" "Hedgehog.exe" +) else ( + copy "build\Hedgehog.exe" "Hedgehog-%~1.exe" +) + +endlocal