diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index bbc8f9f..9737e5b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,22 +1,20 @@ -name: Build +name: Build and Release on: push: branches: [ master, main ] + tags: + - 'v*' pull_request: branches: [ master, main ] jobs: build-windows: runs-on: windows-latest - env: VULKAN_SDK: C:\VulkanSDK\1.3.290.0 - steps: - uses: actions/checkout@v4 - with: - submodules: recursive - name: Cache Vulkan SDK id: cache-vulkan @@ -34,9 +32,10 @@ jobs: - name: Clone dependencies run: | - git clone --depth 1 https://github.com/glfw/glfw.git external/glfw - git clone --depth 1 https://github.com/g-truc/glm.git external/glm - git clone --depth 1 https://github.com/ocornut/imgui.git external/imgui + if (!(Test-Path "external/glfw")) { git clone --depth 1 https://github.com/glfw/glfw.git external/glfw } + if (!(Test-Path "external/glm")) { git clone --depth 1 https://github.com/g-truc/glm.git external/glm } + if (!(Test-Path "external/imgui")) { git clone --depth 1 https://github.com/ocornut/imgui.git external/imgui } + shell: pwsh - name: Configure CMake run: cmake -B build -S . -DCMAKE_BUILD_TYPE=Release @@ -53,3 +52,40 @@ jobs: cmd /c compile_shaders.bat } shell: pwsh + + - name: Package + run: | + mkdir release + copy build\Release\RacingEngine.exe release\ + mkdir release\shaders\compiled + copy shaders\compiled\*.spv release\shaders\compiled\ + if (Test-Path "assets") { + xcopy /E /I assets release\assets + } + Compress-Archive -Path release\* -DestinationPath RacingEngine-Windows.zip + shell: pwsh + + - name: Upload Artifact + uses: actions/upload-artifact@v4 + with: + name: windows-bin + path: RacingEngine-Windows.zip + + release: + needs: [build-windows] + if: startsWith(github.ref, 'refs/tags/') + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - name: Download all artifacts + uses: actions/download-artifact@v4 + + - name: List artifacts + run: ls -R + + - name: Create Release + uses: softprops/action-gh-release@v2 + with: + files: | + windows-bin/RacingEngine-Windows.zip