Fix some comments #123
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 & Latest Release (Linux + Windows) | |
| on: | |
| pull_request: | |
| branches: [ master ] | |
| push: | |
| branches: [ master ] | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| jobs: | |
| # ───────────────────────────────────────────────────────── build ── | |
| build: | |
| env: # ←─ use block style, no braces | |
| SHORT_SHA: ${{ github.sha }} | |
| strategy: | |
| matrix: | |
| include: | |
| - os: ubuntu-22.04 | |
| cfg: linux-release | |
| build: linux-build | |
| isLinux: true | |
| - os: windows-2022 | |
| cfg: windows-release | |
| build: windows-build | |
| isLinux: false | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| # 1) checkout & deps ───────────────────────────────────────────── | |
| - uses: actions/checkout@v4 | |
| - name: Install packages (apt) | |
| if: matrix.isLinux | |
| run: | | |
| sudo apt-get update -y | |
| sudo apt-get install -y --no-install-recommends \ | |
| clang ninja-build cmake build-essential \ | |
| libxmu-dev libxi-dev libxinerama-dev libxrandr-dev \ | |
| libxcursor-dev libudev-dev libopenal-dev unixodbc-dev \ | |
| libgl1-mesa-dev libxxf86vm-dev zlib1g-dev | |
| - name: Set up MSVC env | |
| if: matrix.os == 'windows-2022' | |
| uses: ilammy/msvc-dev-cmd@v1 | |
| with: { arch: x64 } | |
| - name: Verify Ninja on PATH | |
| run: ninja --version | |
| # 2) unzip engine files ────────────────────────────────────────── | |
| - name: Unzip Engine files (Linux) | |
| if: matrix.isLinux | |
| run: | | |
| unzip -q assets/Engine.zip -d assets | |
| unzip -q third_party/EE/Engine.zip -d third_party/EE | |
| - name: Unzip Engine files (Windows) | |
| if: matrix.os == 'windows-2022' | |
| shell: pwsh | |
| run: | | |
| Expand-Archive assets/Engine.zip -DestinationPath assets -Force | |
| Get-ChildItem third_party/EE -Filter '*.zip' | | |
| ForEach-Object { Expand-Archive $_.FullName -DestinationPath third_party/EE -Force } | |
| # 3) configure → build → test ─────────────────────────────────── | |
| - name: Configure | |
| run: cmake --preset ${{ matrix.cfg }} | |
| - name: Build | |
| run: cmake --build --preset ${{ matrix.build }} | |
| - name: Run unit tests | |
| run: ctest --test-dir out/build/${{ matrix.cfg }} --output-on-failure | |
| # 4) package + archive ────────────────────────────────────────── | |
| - name: Package & archive (Linux) | |
| if: matrix.isLinux | |
| run: | | |
| set -euo pipefail | |
| STAGE=out/dist | |
| mkdir -p "$STAGE/Bin" | |
| cp "out/build/${{ matrix.cfg }}/apps/client/client" "$STAGE/client" | |
| cp "out/build/${{ matrix.cfg }}/apps/server/server" "$STAGE/server" | |
| cp assets/Engine.pak "$STAGE/Bin/Engine.pak" | |
| cp assets/Project.pak "$STAGE/Bin/Project.pak" | |
| ARCHIVE=linux_binaries_${SHORT_SHA:0:8}.tar.gz | |
| tar -czf "$ARCHIVE" -C "$STAGE" . | |
| echo "ARCHIVE_PATH=$ARCHIVE" >> $GITHUB_ENV | |
| - name: Package & archive (Windows) | |
| if: matrix.os == 'windows-2022' | |
| shell: pwsh | |
| run: | | |
| $Stage = "out/dist" | |
| New-Item "$Stage/Bin" -ItemType Directory -Force | Out-Null | |
| Copy-Item "out/build/${{ matrix.cfg }}/apps/client/client.exe" "$Stage/client.exe" | |
| Copy-Item "out/build/${{ matrix.cfg }}/apps/server/server.exe" "$Stage/server.exe" | |
| Copy-Item "assets/Engine.pak" "$Stage/Bin/Engine.pak" | |
| Copy-Item "assets/Project.pak" "$Stage/Bin/Project.pak" | |
| $sha = $env:SHORT_SHA.Substring(0,8) | |
| $archive = "windows_binaries_${sha}.zip" | |
| Compress-Archive -Path "$Stage/*" -DestinationPath $archive | |
| echo "ARCHIVE_PATH=$archive" >> $env:GITHUB_ENV | |
| # 5) upload exactly that one file ──────────────────────────────── | |
| - name: Upload platform archive | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: binaries-${{ matrix.os }} | |
| path: ${{ env.ARCHIVE_PATH }} | |
| retention-days: 2 | |
| # ───────────────────────────────────────────────────── release ── | |
| release: | |
| needs: build | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/master' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| # 1) Clean slate: delete old “latest” release + tag (if present) | |
| - name: Delete previous Latest release | |
| env: | |
| GITHUB_TOKEN: ${{ github.token }} # <- use the name gh expects | |
| run: | | |
| # The CLI exits 1 if the release/tag doesn't exist; ignore that. | |
| gh release delete latest --cleanup-tag --yes --repo "$GITHUB_REPOSITORY" 2>&1 | \ | |
| grep -v "release.*not found" || true | |
| # 2) Download fresh archives built by the matrix | |
| - name: Download platform archives | |
| uses: actions/download-artifact@v4 | |
| with: | |
| pattern: binaries-* | |
| merge-multiple: true | |
| path: release # → release/*.zip / *.tar.gz | |
| # 3) Metadata for title & body | |
| - name: Build release metadata | |
| id: vars | |
| run: | | |
| echo "timestamp=$(date -u +'%Y-%m-%d %H:%M UTC')" >> $GITHUB_OUTPUT | |
| echo "short_sha=${GITHUB_SHA::8}" >> $GITHUB_OUTPUT | |
| # 4) Publish brand-new Latest release with ONLY the two archives | |
| - name: Publish Latest release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: latest | |
| make_latest: true | |
| name: Latest build – ${{ steps.vars.outputs.timestamp }} | |
| body: | | |
| Automatic build from commit \ | |
| [`${{ steps.vars.outputs.short_sha }}`]\ | |
| (${{ github.server_url }}/${{ github.repository }}/commit/${{ github.sha }}). | |
| files: | | |
| release/*.zip | |
| release/*.tar.gz |