Update build.yml #101
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 C/C++ | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
jobs: | |
linux: | |
name: Linux Build | |
runs-on: ubuntu-latest | |
container: centos:8 | |
steps: | |
- name: Setup Checkout | |
uses: actions/checkout@v3 | |
- name: Fix CentOS 8 EOL repositories | |
run: | | |
sed -i.bak 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-* | |
sed -i.bak 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-* | |
- name: Update cache | |
run: yes | yum -y --assumeyes makecache | |
- name: CentOS 8 Power Tools | |
run: | | |
yes | yum -y --assumeyes install dnf-plugins-core | |
yum config-manager --set-enabled PowerTools | |
- name: Install build dependencies | |
run: yes | yum -y --assumeyes install @'Development Tools' glibc-devel.i686 libgcc.i686 libstdc++-devel.i686 libgcc.i686 libstdc++-static.i686 wget | |
- name: Run build | |
working-directory: ./MatchBot | |
run: | | |
export CPATH=$CPATH:/usr/include/c++/4.8.5/i686-redhat-linux | |
make | |
- name: Make Match BOT path | |
run: mkdir -p publish/addons/matchbot/dlls | |
- name: Move released file to dlls | |
run: mv ./MatchBot/Release/matchbot_mm.so publish/addons/matchbot/dlls | |
- name: Copy cstrike contents to publish dir | |
run: cp -ar cstrike/. publish | |
- name: Get latest release version of metamod-r | |
run: wget --quiet https://github.com/theAsmodai/metamod-r/releases/download/1.3.0.149/metamod-bin-1.3.0.149.zip | |
- name: Unzip metamod library to metamod folder | |
run: unzip -p metamod-bin*.zip addons/metamod/metamod_i386.so > publish/addons/metamod/metamod_i386.so | |
- name: Get latest release version of hitbox_fixer | |
run: wget --quiet https://github.com/Garey27/hitbox_fixer/releases/download/1.1.5/hitbox_fix-bin-1.1.5.zip | |
- name: Unzip hitbox_fixer library to metamod folder | |
run: unzip -p hitbox_fix-bin*.zip addons/hitbox_fix/hitbox_fix_mm_i386.so > publish/addons/hitbox_fix/hitbox_fix_mm_i386.so | |
- name: Download Accuracy Fix | |
run: wget --quiet https://github.com/SmileYzn/AccuracyFix/releases/download/1.1.16/linux32.zip | |
- name: Unzip accuracy-fix library to metamod folder | |
run: unzip -p linux32.zip addons/accuracyfix/dlls/accuracyfix_mm.so > publish/addons/accuracyfix/accuracyfix_mm.so | |
- name: Deploy artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: linux32 | |
path: publish/* | |
windows: | |
name: Windows Build | |
runs-on: windows-latest | |
env: | |
SOLUTION_FILE_PATH: . | |
BUILD_CONFIGURATION: Release | |
steps: | |
- name: Setup Checkout | |
uses: actions/checkout@v4 | |
- name: Add MSBuild to PATH | |
uses: microsoft/setup-msbuild@v2 | |
- name: Restore NuGet packages | |
working-directory: ${{env.GITHUB_WORKSPACE}} | |
run: nuget restore ${{env.SOLUTION_FILE_PATH}} | |
- name: Run Build | |
working-directory: ${{env.GITHUB_WORKSPACE}} | |
run: msbuild /m /p:Configuration=${{env.BUILD_CONFIGURATION}} ${{env.SOLUTION_FILE_PATH}} | |
- name: Move release file to publish | |
working-directory: ${{env.GITHUB_WORKSPACE}} | |
run: | | |
# Make publish directory | |
mkdir publish\addons\matchbot\dlls | |
# Move cstrike files to publish | |
copy ${{env.SOLUTION_FILE_PATH}}\cstrike\* publish -Recurse -Force | |
# Move released dll to publish | |
copy ${{env.BUILD_CONFIGURATION}}\*.dll publish\addons\matchbot\dlls -Recurse -Force | |
- name: Download Metamod-r | |
run: | | |
# Set assets data | |
$assets = "https://github.com/theAsmodai/metamod-r/releases/download/1.3.0.149/metamod-bin-1.3.0.149.zip" | |
# Get ZIP file name | |
$zipName = "metamod-bin-1.3.0.138.zip" | |
# Download ZIP file | |
Invoke-WebRequest -Uri $assets -Out $zipName | |
# Extract ZIP File | |
Expand-Archive $zipName | |
# Get base name from ZIP file | |
$baseName = (Get-Item $zipName).BaseName | |
# DLL from path | |
$fromPath = ".\" + $baseName + "\addons\metamod\metamod.dll" | |
# DLL dest path | |
$DestPath = ".\publish\addons\metamod\metamod.dll" | |
# Copy item | |
Copy-Item -Path $fromPath -Destination $DestPath | |
- name: Download Hitbox Fixer | |
run: | | |
# Set assets data | |
$assets = "https://github.com/Garey27/hitbox_fixer/releases/download/1.1.5/hitbox_fix-bin-1.1.5.zip" | |
# Get ZIP file name | |
$zipName = "hitbox_fix-bin-1.1.5.zip" | |
# Download ZIP file | |
Invoke-WebRequest -Uri $assets -Out $zipName | |
# Extract ZIP File | |
Expand-Archive $zipName | |
# Get base name from ZIP file | |
$baseName = (Get-Item $zipName).BaseName | |
# DLL from path | |
$fromPath = ".\" + $baseName + "\addons\hitbox_fix\hitbox_fix_mm.dll" | |
# DLL dest path | |
$DestPath = ".\publish\addons\hitbox_fix\hitbox_fix_mm.dll" | |
# Copy item | |
Copy-Item -Path $fromPath -Destination $DestPath | |
- name: Download Accuracy Fix | |
run: | | |
# Set assets data | |
$assets = "https://github.com/SmileYzn/AccuracyFix/releases/download/1.1.16/win32.zip" | |
# Get ZIP file name | |
$zipName = "win32.zip" | |
# Download ZIP file | |
Invoke-WebRequest -Uri $assets -Out $zipName | |
# Extract ZIP File | |
Expand-Archive $zipName | |
# Get base name from ZIP file | |
$baseName = (Get-Item $zipName).BaseName | |
# DLL from path | |
$fromPath = ".\" + $baseName + "\addons\accuracyfix\dlls\accuracyfix_mm.dll" | |
# DLL dest path | |
$DestPath = ".\publish\addons\accuracyfix\accuracyfix_mm.dll" | |
# Copy item | |
Copy-Item -Path $fromPath -Destination $DestPath | |
- name: Deploy artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: win32 | |
path: publish/* |