name: Continuous Integration on: push: tags: - '*' workflow_dispatch: permissions: contents: write jobs: build-linux: name: Build on Linux via Docker Compose runs-on: ubuntu-latest steps: - name: Checkout repository uses: actions/checkout@v4 with: submodules: recursive - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - name: Build plugin inside container run: docker compose -f docker/docker-compose.yml up --build --abort-on-container-exit - name: Upload Linux artifact uses: actions/upload-artifact@v4 with: name: RayTrace-linux path: build/addons build-windows: name: Build on Windows (MSVC) runs-on: windows-latest steps: - name: Checkout repository uses: actions/checkout@v4 with: submodules: recursive - name: Prepare SDK directory shell: powershell run: | $SDK = "C:\sdk" $HL2SDK = "$SDK\hl2sdk-cs2" $MMS = "$SDK\metamod-source" $PROTO = "$SDK\Protobufs" if (Test-Path $SDK) { Remove-Item $SDK -Recurse -Force } New-Item -ItemType Directory -Path $SDK | Out-Null Write-Host "=== Downloading HL2SDK-CS2 ===" git clone --depth=1 -b cs2 https://github.com/alliedmodders/hl2sdk $HL2SDK Write-Host "=== Downloading Metamod-Source ===" git clone --depth=1 https://github.com/alliedmodders/metamod-source $MMS Write-Host "=== Downloading Protobufs ===" git clone --depth=1 https://github.com/SteamDatabase/Protobufs $PROTO $HL2SDK_UNIX = $HL2SDK.Replace("\", "/") $MMS_UNIX = $MMS.Replace("\", "/") $PROTO_UNIX = "$($PROTO.Replace('\','/'))/csgo" echo "HL2SDKCS2=$HL2SDK_UNIX" | Out-File -FilePath $env:GITHUB_ENV -Append echo "MMSOURCE_DEV=$MMS_UNIX" | Out-File -FilePath $env:GITHUB_ENV -Append echo "CSGO_PROTO=$PROTO_UNIX" | Out-File -FilePath $env:GITHUB_ENV -Append Write-Host "Using HL2SDKCS2=$HL2SDK_UNIX" Write-Host "Using MMSOURCE_DEV=$MMS_UNIX" Write-Host "Using CSGO_PROTO=$PROTO_UNIX" - name: Configure + Build with MSVC shell: cmd run: | call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat" cmake -S . -B build -A x64 -DCMAKE_BUILD_TYPE=Release ^ -DHL2SDKCS2=%HL2SDKCS2% -DMMSOURCE_DEV=%MMSOURCE_DEV% -DCSGO_PROTO=%CSGO_PROTO% cmake --build build --config Release --target RayTrace - name: Strip symbols (Windows) run: | llvm-strip build/Release/RayTrace.dll - name: Copy addons structure run: | mkdir -p build/addons/RayTrace/bin/win64 copy build/Release/RayTrace.dll build/addons/RayTrace/bin/win64/ - name: Upload Windows artifact uses: actions/upload-artifact@v4 with: name: RayTrace-windows path: build/addons release: name: Release if: startsWith(github.ref, 'refs/tags/') needs: [ build-linux, build-windows ] runs-on: ubuntu-latest permissions: contents: write steps: - name: Download Linux artifact uses: actions/download-artifact@v4 with: name: RayTrace-linux path: ./artifacts/linux - name: Download Windows artifact uses: actions/download-artifact@v4 with: name: RayTrace-windows path: ./artifacts/windows - name: Prepare release packages run: | version="${GITHUB_REF#refs/tags/}" mkdir -p release mkdir -p mm-linux cp -r artifacts/linux/RayTrace mm-linux/ cp -r artifacts/linux/metamod mm-linux/ || true tar -czf release/RayTrace-MM-${version}-linux.tar.gz \ -C mm-linux . tar -czf release/RayTrace-MM-${version}-windows.tar.gz \ -C artifacts/windows . mkdir -p RayTrace-CSS-API-${version}/counterstrikesharp/plugins mkdir -p RayTrace-CSS-API-${version}/counterstrikesharp/shared cp -r artifacts/linux/counterstrikesharp/plugins/RayTraceImpl \ RayTrace-CSS-API-${version}/counterstrikesharp/plugins/ cp -r artifacts/linux/counterstrikesharp/shared/RayTraceApi \ RayTrace-CSS-API-${version}/counterstrikesharp/shared/ tar -czf release/RayTrace-CSS-API-${version}.tar.gz \ RayTrace-CSS-API-${version} - name: Upload release archives uses: svenstaro/upload-release-action@v2 with: repo_token: ${{ secrets.GITHUB_TOKEN }} file: release/*.tar.gz tag: ${{ github.ref }} file_glob: true release_name: "${{ github.ref_name }}"