l4dtoolz_new/.github/workflows/build.yml

178 lines
4.8 KiB
YAML
Raw Normal View History

2024-05-08 03:55:15 +08:00
name: build
2021-06-30 15:17:42 +08:00
on:
2024-06-17 22:00:44 +08:00
workflow_dispatch:
2021-06-30 15:17:42 +08:00
push:
branches:
2023-12-01 20:22:24 +08:00
- main
2021-06-30 15:17:42 +08:00
- master
2023-12-01 20:22:24 +08:00
tags:
- '*'
2021-06-30 15:17:42 +08:00
paths-ignore:
- LICENSE
- README.md
pull_request:
2023-12-01 20:22:24 +08:00
branches:
- main
- master
2021-06-30 15:17:42 +08:00
paths-ignore:
- LICENSE
- README.md
schedule:
- cron: '30 03 01 */3 *' # Artifacts expire every 3 months
jobs:
build:
name: build with mms${{ matrix.mm_version }} on ${{ matrix.os_short }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
2024-06-17 22:00:44 +08:00
- ubuntu-20.04
2021-06-30 15:17:42 +08:00
- windows-latest
mm_version:
2024-02-15 17:04:36 +08:00
- "master"
2021-06-30 15:17:42 +08:00
include:
2024-02-15 17:04:36 +08:00
- mm_version: "master"
mm_branch: "master"
2021-06-30 15:17:42 +08:00
- os: ubuntu-latest
os_short: linux
2024-06-17 22:00:44 +08:00
- os: ubuntu-20.04
os_short: oldlinux
2021-06-30 15:17:42 +08:00
- 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)
2023-01-19 18:05:48 +08:00
if: startsWith(runner.os, 'Linux')
2021-06-30 15:17:42 +08:00
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
2024-05-08 04:02:47 +08:00
- name: Add msbuild to PATH (Windows)
if: startsWith(runner.os, 'Windows')
uses: microsoft/setup-msbuild@v2
- name: Install (Windows)
if: startsWith(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=x86 -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
)
2021-06-30 15:17:42 +08:00
- name: Checking out MM:Source
2023-12-01 20:22:24 +08:00
uses: actions/checkout@v4
2021-06-30 15:17:42 +08:00
with:
repository: alliedmodders/metamod-source
ref: ${{ matrix.mm_branch }}
path: metamod-${{ matrix.mm_version }}
- name: Setting up Python
2024-02-15 17:04:36 +08:00
uses: actions/setup-python@v5
2021-06-30 15:17:42 +08:00
with:
2023-12-01 20:22:24 +08:00
python-version: '3.11'
2021-06-30 15:17:42 +08:00
- name: Setting up ambuild
2023-01-19 18:05:48 +08:00
run: |
python -m pip install wheel
2024-05-08 04:02:47 +08:00
pip install git+https://github.com/accelerator74/ambuild
2024-05-08 03:55:15 +08:00
- name: Checking out hl2sdk-l4d
uses: actions/checkout@v4
with:
repository: alliedmodders/hl2sdk
ref: l4d
path: hl2sdk-l4d
2021-06-30 15:17:42 +08:00
2021-07-02 16:21:03 +08:00
- name: Checking out hl2sdk-l4d2
2023-12-01 20:22:24 +08:00
uses: actions/checkout@v4
2021-06-30 15:17:42 +08:00
with:
repository: alliedmodders/hl2sdk
ref: l4d2
path: hl2sdk-l4d2
- name: Checking out own repository
2023-12-01 20:22:24 +08:00
uses: actions/checkout@v4
2021-06-30 15:17:42 +08:00
with:
2023-01-19 18:05:48 +08:00
path: src
2021-06-30 15:17:42 +08:00
2024-05-08 03:55:15 +08:00
- name: Compiling ${{ github.event.repository.name }}-l4d files
working-directory: src
run: |
mkdir build_l4d
cd build_l4d
python ../configure.py --enable-optimize --sdks="l4d" --mms-path="${{ github.workspace }}/metamod-${{ matrix.mm_version }}"
ambuild
- name: Compiling ${{ github.event.repository.name }}-l4d2 files
2023-01-19 18:05:48 +08:00
working-directory: src
2021-06-30 15:17:42 +08:00
run: |
2024-05-08 03:55:15 +08:00
mkdir build_l4d2
cd build_l4d2
2021-06-30 15:17:42 +08:00
python ../configure.py --enable-optimize --sdks="l4d2" --mms-path="${{ github.workspace }}/metamod-${{ matrix.mm_version }}"
ambuild
2024-05-08 03:55:15 +08:00
- name: Uploading l4d package
uses: actions/upload-artifact@v4
with:
name: ${{ github.event.repository.name }}-l4d-${{ matrix.os_short }}-${{ env.GITHUB_SHA_SHORT }}
path: src/build_l4d/package
- name: Uploading l4d2 package
2024-02-15 17:04:36 +08:00
uses: actions/upload-artifact@v4
2021-06-30 15:17:42 +08:00
with:
2024-02-15 17:04:36 +08:00
name: ${{ github.event.repository.name }}-l4d2-${{ matrix.os_short }}-${{ env.GITHUB_SHA_SHORT }}
2024-05-08 03:55:15 +08:00
path: src/build_l4d2/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