v1.0.0 - Added Linux support #15
Workflow file for this run
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 and Release | |
| on: | |
| release: | |
| types: [published] | |
| env: | |
| BUILD_TYPE: Release | |
| jobs: | |
| build-linux: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Initialize and update submodules | |
| run: git submodule update --init --recursive | |
| - name: Install dependencies | |
| run: sudo apt-get update && sudo apt-get install -y libgl1-mesa-dev libwayland-dev wayland-protocols libxkbcommon-dev xorg-dev | |
| - name: Clear CMake Cache | |
| run: rm -rf build/* | |
| - name: Configure CMake project | |
| run: cmake -B . -S . -DGLFW_BUILD_WAYLAND=OFF -DGLFW_BUILD_X11=ON | |
| - name: Build for Linux | |
| run: cmake --build . --config ${{env.BUILD_TYPE}} | |
| - name: Package binaries | |
| run: cd build/bin && zip -r ../../HeronTriangle-Linux.zip . && cd ../../ | |
| - name: Upload Linux Release | |
| uses: actions/upload-artifact@v3 | |
| with: | |
| name: HeronTriangle-Linux | |
| path: HeronTriangle-Linux.zip | |
| build-windows: | |
| runs-on: windows-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Initialize and update submodules | |
| run: git submodule update --init --recursive | |
| - name: Configure CMake project | |
| run: cmake -B . -S . | |
| - name: Build for Windows | |
| run: cmake --build . --config ${{env.BUILD_TYPE}} | |
| - name: Package binaries | |
| run: powershell -Command "Compress-Archive -Path build\bin\* -DestinationPath HeronTriangle-Windows.zip" | |
| - name: Upload Windows Release | |
| uses: actions/upload-artifact@v3 | |
| with: | |
| name: HeronTriangle-Windows | |
| path: HeronTriangle-Windows.zip | |
| release: | |
| needs: [build-linux, build-windows] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Install jq | |
| run: sudo apt-get install -y jq | |
| - name: Download Linux artifacts | |
| uses: actions/download-artifact@v3 | |
| with: | |
| name: HeronTriangle-Linux | |
| path: ./artifacts/linux | |
| - name: Download Windows artifacts | |
| uses: actions/download-artifact@v3 | |
| with: | |
| name: HeronTriangle-Windows | |
| path: ./artifacts/windows | |
| - name: Attach Artifacts to Release | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| release_id=$(curl -s \ | |
| -H "Authorization: Bearer $GITHUB_TOKEN" \ | |
| https://api.github.com/repos/${{ github.repository }}/releases/latest | jq -r '.id') | |
| echo "Release ID: $release_id" | |
| for file in ./artifacts/linux/* ./artifacts/windows/*; do | |
| filename=$(basename "$file") | |
| echo "Uploading $filename to release $release_id" | |
| curl -X POST \ | |
| -H "Authorization: Bearer $GITHUB_TOKEN" \ | |
| -H "Content-Type: application/zip" \ | |
| --data-binary @"$file" \ | |
| "https://uploads.github.com/repos/${{ github.repository }}/releases/$release_id/assets?name=$filename" | |
| done |