chore: trying to fix the release workflow #26
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: LLHL - New version release | |
on: | |
push: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
container: centos:centos7 | |
env: | |
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true | |
steps: | |
- name: Setting up mirrorlist | |
run: | | |
sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-* | |
sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-* | |
- name: Install Node.js (v16) | |
run: | | |
curl -sL https://rpm.nodesource.com/setup_16.x | bash - | |
yum install -y nodejs | |
- name: Checkout LLHL AGMOD repository | |
uses: actions/checkout@v2 | |
with: | |
repository: 7mochi/llhl-agmod | |
path: llhl-agmod | |
fetch-depth: 0 | |
persist-credentials: false | |
- name: Build LLHL AGMOD serverfile .so | |
run: | | |
yum install -y make git gcc gcc-c++ glibc-devel.i686 libstdc++-devel.i686 | |
mkdir ag-llhl-linux && cd llhl-agmod | |
CPATH=$CPATH:/usr/include/c++/4.8.5/i686-redhat-linux CFG=$CONFIGURATION make -C dlls | |
cd $GITHUB_WORKSPACE | |
cp -i llhl-agmod/dlls/ag_i386.so ag-llhl-linux/ag.so | |
cp -i llhl-agmod/network/delta.lst ag-llhl-linux | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Install NodeJS | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- name: Install dependencies for Linux | |
run: | | |
make init-linux | |
- name: Build LLHL proyect (Linux) with node-amxxpack | |
run: | | |
make build-linux | |
- name: Rename dist folder | |
run: | | |
mv dist dist-linux | |
- name: Install dependencies for Windows | |
run: | | |
make init-windows | |
- name: Build LLHL proyect (Windows) with node-amxxpack | |
run: | | |
make build-windows | |
- name: Generate hashfile.sha1 | |
run: | | |
# First linux | |
cd dist-linux | |
# Find all files in the dist folder except for a few | |
find "$PWD" -type f -not -name "llhl.cfg" \ | |
-and -not -name "plugins.ini" \ | |
-and -not -name "*.inc" \ | |
-and -not -name "*.sma" \ | |
-and -not -name "*.gam" \ | |
-and -not -name "motd_llhl*" \ | |
-and -not -name "startup_server.cfg" \ | |
-and -not -name "*.sha1" \ | |
-exec sha1sum {} \; > hashfile.sha1 | |
# Go back to root folder | |
cd $GITHUB_WORKSPACE | |
# Move hashfile out of dist folder | |
mv dist-linux/hashfile.sha1 hashfile.sha1 | |
# Now windows | |
cd dist | |
# Find remaining files | |
find "$PWD" -type f -name "*.dll" -exec sha1sum {} \; > hashfile_2.sha1 | |
# Go back again | |
cd $GITHUB_WORKSPACE | |
# Move hashfile 2 out of dist folder | |
mv dist/hashfile_2.sha1 hashfile_2.sha1 | |
# Merge the contents of both files | |
cat hashfile_2.sha1 >> hashfile.sha1 && rm hashfile_2.sha1 | |
# Remove useless path from the hashfile | |
sed -e "s,${PWD}/dist-linux/ag/,,g; s,${PWD}/dist/ag/,,g; s,addons/amxmodx/plugins/,,g" -i hashfile.sha1 | |
- name: Replace llhl.amxx on windows with the one from linux | |
run: | | |
yes | cp -rf dist-linux/ag/addons/amxmodx/plugins/llhl.amxx dist/ag/addons/amxmodx/plugins/llhl.amxx | |
- name: Download latest AMX Mod X 1.9 | |
run: | | |
wget "https://www.amxmodx.org/latest.php?version=1.9&os=linux&package=base" -O amxx-linux.tar.gz | |
wget "https://www.amxmodx.org/latest.php?version=1.9&os=windows&package=base" -O amxx-windows.zip | |
tar -xzf amxx-linux.tar.gz -C dist-linux/ag | |
unzip amxx-windows.zip -d dist/ag | |
- name: Create folder and move LLHL AGMOD .so | |
run: | | |
mkdir dist-linux/ag/dlls | |
mv llhl-agmod/ag-llhl-linux/ag.so dist-linux/ag/ag.so | |
- name: Prepare releases in zip | |
run: | | |
cd dist-linux && zip -r ../llhl-${{github.ref_name}}-linux.zip * && cd $GITHUB_WORKSPACE | |
cd dist && zip -r ../llhl-${{github.ref_name}}-windows.zip * && cd $GITHUB_WORKSPACE |