Skip to content

0.8.0-pre2

0.8.0-pre2 #6

# Builds when a release is published.
name: Build Workflow
on:
release:
types: [published]
jobs:
build:
name: Build for ${{ matrix.os_short }} using sm-${{ matrix.sm_branch }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-20.04
- windows-latest
target_arch:
- x86
- x86_64
include:
- meta_branch: "master"
sm_branch: "master"
spcomp_version: "1.11.x"
- os: ubuntu-20.04
target_arch: x86
os_short: linux
- os: ubuntu-20.04
target_arch: x86_64
os_short: linux64
- os: windows-latest
target_arch: x86
os_short: win
vs_dev_arch: x86
- os: windows-latest
target_arch: x86_64
os_short: win64
vs_dev_arch: x64
steps:
- name: Prepare env
shell: bash
run: |
echo "GITHUB_SHA_SHORT=${GITHUB_SHA::7}" >> $GITHUB_ENV
- name: Install (Linux)
if: runner.os == 'Linux'
run: |
sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install -y clang g++-multilib
echo "CC=clang" >> $GITHUB_ENV
echo "CXX=clang++" >> $GITHUB_ENV
- name: Add msbuild to PATH (Windows)
if: runner.os == 'Windows'
uses: microsoft/setup-msbuild@v2
- name: Install (Windows)
if: runner.os == 'Windows'
shell: cmd
run: |
:: See https://github.com/microsoft/vswhere/wiki/Find-VC
for /f "usebackq delims=*" %%i in (`vswhere -latest -property installationPath`) do (
call "%%i"\Common7\Tools\vsdevcmd.bat -arch=${{ matrix.vs_dev_arch }} -host_arch=x64
)
:: Loop over all environment variables and make them global.
for /f "delims== tokens=1,2" %%a in ('set') do (
echo>>"%GITHUB_ENV%" %%a=%%b
)
- name: Fetch Metamod:Source ${{ matrix.meta_branch }}
uses: actions/checkout@v4
with:
repository: alliedmodders/metamod-source
ref: ${{ matrix.meta_branch }}
path: mmsource
- name: Fetch SourceMod ${{ matrix.sm_branch }}
uses: actions/checkout@v4
with:
repository: alliedmodders/sourcemod
ref: ${{ matrix.sm_branch }}
path: sourcemod
submodules: recursive
- name: Checkout AMBuild
uses: actions/checkout@v4
with:
repository: alliedmodders/ambuild
path: ambuild
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Set up spcomp
uses: rumblefrog/setup-sp@v1.2.2
with:
version: ${{ matrix.spcomp_version }}
no-spcomp-proxy: true
- name: Checkout ambuild
run: |
python -m pip install wheel
pip install git+https://github.com/alliedmodders/ambuild
- name: Checkout project
uses: actions/checkout@v4
with:
path: src
- name: Build Files
working-directory: src
run: |
mkdir build
cd build
python3 ../configure.py --sm-path="${{ github.workspace }}/sourcemod" --mms-path="${{ github.workspace }}/mmsource" --symbol-files --enable-optimize --targets ${{ matrix.target_arch }}
ambuild
- name: Upload Build Artifact
id: upload-build-artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.os_short }}-${{ matrix.target_arch }}
path: src/build/package
combine_packages:
name: Upload assets for for ${{ matrix.os_short }}
needs: [build]
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-20.04
- windows-latest
include:
- os: ubuntu-20.04
os_short: linux
package_ext: .tar.gz
- os: windows-latest
os_short: win
package_ext: zip
steps:
- name: Download Build Artifacts
uses: actions/download-artifact@v4
with:
path: src/build/package
pattern: ${{ matrix.os_short }}*
merge-multiple: true
- name: Build Package (Windows)
if: runner.os == 'Windows'
working-directory: src/build
shell: cmd
run: |
pushd package
7z a -r "../package.${{ matrix.package_ext }}" addons
popd
- name: Build Package (Linux)
if: runner.os == 'Linux'
working-directory: src/build
shell: bash
run: |
pushd package
tar -czf "../package.${{ matrix.package_ext }}" --owner=0 --group=0 addons
popd
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: src/build/package.${{ matrix.package_ext }}
asset_name: package.${{ matrix.package_ext }}
asset_content_type: application/octet-stream