-
Notifications
You must be signed in to change notification settings - Fork 10
132 lines (107 loc) · 4.95 KB
/
amxx.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
name: AG Mod X - Full release package
on:
push:
pull_request:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v1
- name: Download latest AMX Mod X v1.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
mkdir amxx-windows amxx-linux
tar -xzf amxx-linux.tar.gz -C amxx-linux && unzip amxx-windows.zip -d amxx-windows
- name: Download Metamod-P CMake v1.21p39
run: |
wget "https://github.com/rtxa/Metamod-P-CMake/releases/download/v1.21p39/metamod-cmake-1.21p39-win32-linux.zip" -O metamod.zip
unzip metamod.zip -d metamod
- name: Compile plugins
run: |
# This dir will contain compiled plugins
mkdir .plugins
# Move to the folder where the compiler is located
cd amxx-linux/addons/amxmodx/scripting
# Add missing native is_user_authorized (amxmodx.inc)
sed 's/native is_user_hltv(index);/& \nnative is_user_authorized(index);\n/' include/amxmodx.inc -i
# Give amxxpc the required permissions
chmod +x amxxpc
# Compile all plugins inside scripting folder
for file in $GITHUB_WORKSPACE/valve/addons/amxmodx/scripting/*.sma
do
filename="`echo $(basename -s .sma $file)`"
echo -e "\nCompiling $filename.sma"
./amxxpc -i$GITHUB_WORKSPACE/valve/addons/amxmodx/scripting/include $file -o$GITHUB_WORKSPACE/.plugins/$filename.amxx
done
# Return to initial location
cd $GITHUB_WORKSPACE
- name: Create AG Mod X folder structure
run: |
for agmodx_folder in agmodx-dev-linux agmodx-dev-windows
do
mkdir -p $agmodx_folder/valve && cd $_
mkdir addons ctf dlls gamemodes locs models sound
cd $GITHUB_WORKSPACE
done
- name: Copy AMX Mod X and compiled plugins
run: |
# Copy amxmodx addons folder (Windows and linux)
cp -a amxx-linux/addons/* agmodx-dev-linux/valve/addons
cp -a amxx-windows/addons/* agmodx-dev-windows/valve/addons
# Copy compiled plugins
cp -a .plugins/*.amxx agmodx-dev-linux/valve/addons/amxmodx/plugins
cp -a .plugins/*.amxx agmodx-dev-windows/valve/addons/amxmodx/plugins
- name: Copy assets
run: |
# Copy assets to both platforms
rsync -av --exclude=dlls valve agmodx-dev-linux
rsync -av --exclude=dlls valve agmodx-dev-windows
# Copy server binaries according to platform
cp valve/dlls/*.so agmodx-dev-linux/valve/dlls/
cp valve/dlls/*.dll agmodx-dev-windows/valve/dlls/
- name: Copy and setup Metamod
run: |
# Create metamod folder
mkdir -p agmodx-dev-linux/valve/addons/metamod/dlls
mkdir -p agmodx-dev-windows/valve/addons/metamod/dlls
# Copy metamod
cp metamod/*.so agmodx-dev-linux/valve/addons/metamod/dlls
cp metamod/*.dll agmodx-dev-windows/valve/addons/metamod/dlls
# Add amxmodx to metamod plugins
echo 'linux addons/amxmodx/dlls/amxmodx_mm_i386.so' > agmodx-dev-linux/valve/addons/metamod/plugins.ini
echo 'win32 addons/amxmodx/dlls/amxmodx_mm.dll' > agmodx-dev-windows/valve/addons/metamod/plugins.ini
# Create liblist.gam file
liblist='// Valve Game Info file'
liblist+='\n// These are key/value pairs. Certain mods will use different settings.'
liblist+='\ngame "Half-Life"'
liblist+='\nstartmap "c0a0"'
liblist+='\ntrainmap "t0a0"'
liblist+='\nmpentity "info_player_deathmatch"'
liblist+='\ngamedll "addons\metamod\dlls\metamod.dll"'
liblist+='\ngamedll_linux "addons/metamod/dlls/metamod.so"'
liblist+='\ngamedll_osx "dlls/hl.dylib"'
liblist+='\nsecure "1"'
liblist+='\ntype "singleplayer_only"'
echo -e $liblist > agmodx-dev-linux/valve/liblist.gam
echo -e $liblist > agmodx-dev-windows/valve/liblist.gam
- name: Remove unnecessary files
run: |
rm -r agmodx-dev-linux/valve/addons/amxmodx/scripting
rm -r agmodx-dev-windows/valve/addons/amxmodx/scripting
- name: Get current tag and commit SHA for artifact naming
id: naming
run: |
echo "tag=$(git describe --tags --abbrev=0)" >> $GITHUB_OUTPUT
echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: Upload AG Mod X package for Linux
uses: actions/upload-artifact@master
with:
name: agmodx-${{ steps.naming.outputs.tag }}-dev-linux-${{ steps.naming.outputs.sha_short }}
path: agmodx-dev-linux
- name: Upload AG Mod X package for Windows
uses: actions/upload-artifact@master
with:
name: agmodx-${{ steps.naming.outputs.tag }}-dev-windows-${{ steps.naming.outputs.sha_short }}
path: agmodx-dev-windows