name: CI on: push: branches: [ master ] pull_request: branches: [ master ] jobs: version: name: Version runs-on: ubuntu-latest outputs: version: ${{ steps.compute.outputs.version }} steps: - name: Checkout uses: actions/checkout@v7 with: fetch-depth: 0 - name: Compute version id: compute run: | base_version=$(grep -oP 'SMEXT_CONF_VERSION\s+"\K[^"]+' Extension/sdk/smsdk_config.h) build_number=$(git rev-list --count HEAD) echo "version=${base_version}.${build_number}" >> "$GITHUB_OUTPUT" build: name: sm${{ matrix.sm.label }}-${{ matrix.target.os_name }}-${{ matrix.target.arch }} needs: version runs-on: ${{ matrix.target.os }} container: ${{ matrix.target.container }} strategy: fail-fast: false matrix: sm: - label: "1.12" branch: "1.12-dev" - label: "1.13" branch: "master" target: - os: ubuntu-latest os_name: linux arch: x86 container: ghcr.io/alliedmodders/build-containers/debian11-clang22:latest - os: ubuntu-latest os_name: linux arch: x86_64 container: ghcr.io/alliedmodders/build-containers/debian11-clang22:latest - os: windows-latest os_name: windows arch: x86 msvc_arch: x86 - os: windows-latest os_name: windows arch: x86_64 msvc_arch: amd64 steps: - name: Checkout uses: actions/checkout@v7 - name: Setup Python (Windows) if: matrix.target.os_name == 'windows' uses: actions/setup-python@v7 with: python-version: '3.12' - name: Setup MSVC (Windows) if: matrix.target.os_name == 'windows' uses: ilammy/msvc-dev-cmd@v1 with: arch: ${{ matrix.target.msvc_arch }} - name: Install AMBuild if: matrix.target.os_name == 'windows' shell: bash run: python -m pip install --upgrade git+https://github.com/alliedmodders/ambuild.git - name: Clone dependencies shell: bash run: | git config --global --add safe.directory '*' git clone --depth 1 --recurse-submodules -j8 --shallow-submodules https://github.com/rlabrecque/SteamworksSDK.git SteamworksSDK git clone --depth 1 --recurse-submodules -j8 --shallow-submodules -b 1.12-dev https://github.com/alliedmodders/metamod-source.git mmsource git clone --depth 1 --recurse-submodules -j8 --shallow-submodules -b ${{ matrix.sm.branch }} https://github.com/alliedmodders/sourcemod.git sourcemod - name: Build (Linux) if: matrix.target.os_name == 'linux' env: CC: clang-22 CXX: clang++-22 run: | mkdir build && cd build python3 ../configure.py \ --sm-path ../sourcemod \ --mms-path ../mmsource \ --steamworks-path ../SteamworksSDK \ --target ${{ matrix.target.arch }} \ --version "${{ needs.version.outputs.version }}" \ --enable-optimize ambuild - name: Build (Windows) if: matrix.target.os_name == 'windows' shell: bash run: | mkdir build && cd build python ../configure.py \ --sm-path ../sourcemod \ --mms-path ../mmsource \ --steamworks-path ../SteamworksSDK \ --target ${{ matrix.target.arch }} \ --version "${{ needs.version.outputs.version }}" \ --enable-optimize ambuild - name: Upload package artifact uses: actions/upload-artifact@v7 with: name: pkg-sm${{ matrix.sm.label }}-${{ matrix.target.os_name }}-${{ matrix.target.arch }} path: build/package/addons if-no-files-found: error compile-plugins: name: compile-plugins-sm${{ matrix.sm.label }} runs-on: ubuntu-latest strategy: fail-fast: false matrix: sm: - label: "1.12" branch: "1.12-dev" - label: "1.13" branch: "master" steps: - name: Checkout uses: actions/checkout@v7 - name: Clone SourceMod includes run: | git clone --depth 1 -b ${{ matrix.sm.branch }} https://github.com/alliedmodders/sourcemod.git sourcemod - name: Compile Pawn plugins run: | mkdir -p compiled status=0 for f in Pawn/*.sp; do echo "::group::${f}" docker run --rm -v "${{ github.workspace }}:/work" -w /work \ ghcr.io/alliedmodders/sourcemod-spcomp:${{ matrix.sm.branch }} \ -i Pawn/includes -i sourcemod/plugins/include \ "${f}" -o "compiled/$(basename "${f%.sp}.smx")" \ || status=1 echo "::endgroup::" done exit "${status}" release: name: Release needs: [version, build] if: github.event_name == 'push' && github.ref == 'refs/heads/master' runs-on: ubuntu-latest permissions: contents: write steps: - name: Checkout uses: actions/checkout@v7 with: fetch-depth: 0 - name: Download artifacts uses: actions/download-artifact@v8 with: path: artifacts - name: Assemble packages id: package run: | version="${{ needs.version.outputs.version }}" echo "version=${version}" >> "$GITHUB_OUTPUT" # One package per SourceMod version per OS: Windows as .zip, Linux as # .tar.gz. Each merges that combination's per-arch slices (the include # file rides along in every slice). assets="" for label in 1.12 1.13; do for os_name in windows linux; do dest="package-sm${label}-${os_name}/addons" mkdir -p "${dest}" for dir in artifacts/pkg-sm${label}-${os_name}-*/; do cp -a "${dir}." "${dest}/" done if [ "${os_name}" = "windows" ]; then asset="SteamWorks-${version}-sm${label}-windows.zip" (cd "package-sm${label}-${os_name}" && zip -r "../${asset}" addons) else asset="SteamWorks-${version}-sm${label}-linux.tar.gz" tar -czf "${asset}" -C "package-sm${label}-${os_name}" addons fi assets="${assets} ${asset}" done done echo "assets=${assets# }" >> "$GITHUB_OUTPUT" - name: Create release env: GH_TOKEN: ${{ github.token }} run: | gh release create "v${{ steps.package.outputs.version }}" \ ${{ steps.package.outputs.assets }} \ --target "${GITHUB_SHA}" \ --title "SteamWorks ${{ steps.package.outputs.version }}" \ --notes "Automated release built from ${GITHUB_SHA}."