build #82
This file contains 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 | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
- master | |
tags: | |
- '*' | |
paths-ignore: | |
- LICENSE | |
- README.md | |
pull_request: | |
branches: | |
- main | |
- master | |
paths-ignore: | |
- LICENSE | |
- README.md | |
schedule: | |
- cron: '30 03 01 */3 *' # Artifacts expire every 3 months | |
jobs: | |
build: | |
name: build with sm${{ matrix.sm_version }} on ${{ matrix.os_short }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- ubuntu-latest | |
- ubuntu-20.04 | |
- windows-latest | |
sm_version: | |
- "latest" | |
- "1.11" | |
include: | |
- mm_version: "latest" | |
mm_branch: "master" | |
- sm_version: "latest" | |
sm_branch: "master" | |
- sm_version: "1.11" | |
sm_branch: "1.11-dev" | |
- os: ubuntu-latest | |
os_short: linux | |
- os: ubuntu-20.04 | |
os_short: oldlinux | |
- os: windows-latest | |
os_short: win | |
steps: | |
- name: Prepare env | |
shell: bash | |
run: | | |
echo "GITHUB_SHA_SHORT=${GITHUB_SHA::7}" >> $GITHUB_ENV | |
- name: Install (Linux) | |
if: startsWith(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: Checking out SourceMod | |
uses: actions/checkout@v4 | |
with: | |
repository: alliedmodders/sourcemod | |
ref: ${{ matrix.sm_branch }} | |
path: sourcemod-${{ matrix.sm_version }} | |
submodules: recursive | |
- name: Checking out MM:Source | |
uses: actions/checkout@v4 | |
with: | |
repository: alliedmodders/metamod-source | |
ref: ${{ matrix.mm_branch }} | |
path: metamod-${{ matrix.mm_version }} | |
- name: Setting up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.11' | |
- name: Setting up ambuild | |
run: | | |
python -m pip install wheel | |
pip install git+https://github.com/accelerator74/ambuild@nog3 | |
- name: Checking out hl2sdk-l4d2 | |
uses: actions/checkout@v4 | |
with: | |
repository: alliedmodders/hl2sdk | |
ref: l4d2 | |
path: hl2sdk-l4d2 | |
- name: Checking out hl2sdk-l4d | |
uses: actions/checkout@v4 | |
with: | |
repository: alliedmodders/hl2sdk | |
ref: l4d | |
path: hl2sdk-l4d | |
- name: Checking out hl2sdk-css | |
uses: actions/checkout@v4 | |
with: | |
repository: alliedmodders/hl2sdk | |
ref: css | |
path: hl2sdk-css | |
- name: Checking out hl2sdk-tf2 | |
uses: actions/checkout@v4 | |
with: | |
repository: alliedmodders/hl2sdk | |
ref: tf2 | |
path: hl2sdk-tf2 | |
- name: Checking out hl2sdk-csgo | |
uses: actions/checkout@v4 | |
with: | |
repository: alliedmodders/hl2sdk | |
ref: csgo | |
path: hl2sdk-csgo | |
- name: Checking out own repository | |
uses: actions/checkout@v4 | |
with: | |
path: src | |
- name: Compiling ${{ github.event.repository.name }} files | |
shell: bash | |
working-directory: src | |
run: | | |
mkdir build | |
cd build | |
python ../configure.py --enable-optimize --sm-path="${{ github.workspace }}/sourcemod-${{ matrix.sm_version }}" --mms-path="${{ github.workspace }}/metamod-${{ matrix.mm_version }}" --targets=x86,x86_64 | |
ambuild | |
- name: Uploading package | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ github.event.repository.name }}-sm${{ matrix.sm_version }}-${{ matrix.os_short }}-${{ env.GITHUB_SHA_SHORT }} | |
path: src/build/package | |
release: | |
name: Release | |
if: startsWith(github.ref, 'refs/tags/') | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download artifacts | |
uses: actions/download-artifact@v4 | |
- name: Package | |
run: | | |
version=`echo $GITHUB_REF | sed "s/refs\/tags\///"` | |
ls -Rall | |
for folder in ${{ github.event.repository.name }}*; do | |
if [ -d "$folder" ]; then | |
echo "Processing folder: $folder" | |
cd $folder | |
tar -czf ../$folder.tar.gz -T <(\ls -1) | |
cd .. | |
fi | |
done | |
- name: Release | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: '*.tar.gz' | |
tag: ${{ github.ref }} | |
file_glob: true |