Skip to content

Commit 29ca90e

Browse files
committed
Merge branch 'master' of https://github.com/rtxa/agmodx
2 parents 513312f + 9435c2c commit 29ca90e

File tree

1 file changed

+46
-38
lines changed

1 file changed

+46
-38
lines changed

.github/workflows/amxx.yml

Lines changed: 46 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,83 +1,83 @@
1-
name: AG Mod X - Full Package Release
1+
name: AG Mod X - Full release package
22

33
on:
44
push:
55
pull_request:
66

77
jobs:
88
build:
9-
109
runs-on: ubuntu-latest
11-
10+
1211
steps:
13-
- uses: actions/checkout@v1
14-
- name: Download latest amxmodx 1.9 (Linux)
15-
run: |
16-
wget "https://www.amxmodx.org/latest.php?version=1.9&os=linux&package=base" -O amxx.tar.gz
17-
tar -xzf amxx.tar.gz
18-
- name: Download latest amxmodx 1.9 (Windows)
12+
- name: Checkout repository
13+
uses: actions/checkout@v1
14+
15+
- name: Download latest AMX Mod X v1.9
1916
run: |
17+
wget "https://www.amxmodx.org/latest.php?version=1.9&os=linux&package=base" -O amxx-linux.tar.gz
2018
wget "https://www.amxmodx.org/latest.php?version=1.9&os=windows&package=base" -O amxx-windows.zip
21-
mkdir amxx-windows
19+
mkdir amxx-windows amxx-linux
20+
tar -xzf amxx-linux.tar.gz -C amxx-linux
2221
unzip amxx-windows.zip -d amxx-windows
23-
- name: Download Metamod v1.21p39 (Solokiller)
22+
23+
- name: Download Metamod-P v1.21p39
2424
run: |
2525
wget "https://github.com/Solokiller/Metamod-P-CMake/releases/download/v1.21p39/Metamod-P-opt-fast-Linux.zip" -O metamod.zip
2626
wget "https://github.com/Solokiller/Metamod-P-CMake/releases/download/v1.21p39/Metamod-P-opt-fast.zip" -O metamod-win.zip
2727
unzip metamod.zip
2828
unzip metamod-win.zip -d metamod
29-
- name: Give amxxpc the required permissions
30-
run: chmod +x addons/amxmodx/scripting/amxxpc
31-
- name: Compile agmodx plugins
32-
run: |
33-
# Saving the current location to cd later
34-
previousDir=$(pwd)
3529
36-
# Creating agmodx release folder structure (Windows and linux)
30+
- name: Create AG Mod X folder structure for Windows and Linux
31+
run: |
3732
os=("agmodx-dev-linux" "agmodx-dev-windows")
3833
for i in "${os[@]}"
3934
do
4035
mkdir $i && cd $i && mkdir valve && cd valve
4136
mkdir addons ctf dlls gamemodes locs models sound
42-
43-
# Returning to the location where we were before
44-
cd $previousDir
37+
# Return to the initial location
38+
cd $GITHUB_WORKSPACE
4539
done
4640
41+
- name: Copy necessary files for compiling
42+
run: |
4743
# Copy amxmodx addons folder (Windows and linux)
48-
cp -a addons/* agmodx-dev-linux/valve/addons
44+
cp -a amxx-linux/addons/* agmodx-dev-linux/valve/addons
4945
cp -a amxx-windows/addons/* agmodx-dev-windows/valve/addons
5046
5147
# In case the repository has an include folder, we copy the dependencies
5248
if [ -d valve/addons/amxmodx/scripting/include ]; then
5349
echo "Copying non-standard dependencies..."
54-
cp -a valve/addons/amxmodx/scripting/include/*.inc addons/amxmodx/scripting/include
50+
cp -a valve/addons/amxmodx/scripting/include/*.inc amxx-linux/addons/amxmodx/scripting/include
5551
fi
5652
5753
# Add missing native is_user_authorized (amxmodx.inc)
58-
sed 's/native is_user_hltv(index);/& \nnative is_user_authorized(index);\n/' addons/amxmodx/scripting/include/amxmodx.inc -i
54+
sed 's/native is_user_hltv(index);/& \nnative is_user_authorized(index);\n/' amxx-linux/addons/amxmodx/scripting/include/amxmodx.inc -i
5955
56+
- name: Compile plugins
57+
run: |
6058
# Move to the folder where the compiler is located
61-
cd addons/amxmodx/scripting
59+
cd amxx-linux/addons/amxmodx/scripting
60+
61+
# Give amxxpc the required permissions
62+
chmod +x amxxpc
6263
6364
# Compile all plugins inside scripting folder
64-
for file in $previousDir/valve/addons/amxmodx/scripting/*.sma
65+
for file in $GITHUB_WORKSPACE/valve/addons/amxmodx/scripting/*.sma
6566
do
6667
smafile="`echo $file | sed -e 's/\.sma$/\.amxx/'`"
67-
echo -e "\nCompiling $(basename $file)..."
68-
./amxxpc $file -o$previousDir/agmodx-dev-linux/valve/addons/amxmodx/plugins/$(basename "$smafile")
68+
echo -e "\nCompiling $(basename $file)..."
69+
./amxxpc $file -o$GITHUB_WORKSPACE/agmodx-dev-linux/valve/addons/amxmodx/plugins/$(basename "$smafile")
6970
done
7071
71-
# Returning again to the location where we were before
72-
cd $previousDir
72+
# Return to initial location
73+
cd $GITHUB_WORKSPACE
7374
74-
# Copy compiled plugins to windows artifact
75+
# Copy compiled plugins to the windows artifact
7576
cp -a agmodx-dev-linux/valve/addons/amxmodx/plugins/*.amxx agmodx-dev-windows/valve/addons/amxmodx/plugins
7677
77-
# Remove scripting folder
78-
rm -r agmodx-dev-linux/valve/addons/amxmodx/scripting
79-
rm -r agmodx-dev-windows/valve/addons/amxmodx/scripting
80-
78+
- name: Copy the rest of the files
79+
run: |
80+
os=("agmodx-dev-linux" "agmodx-dev-windows")
8181
for systems in "${os[@]}"
8282
do
8383
# Copy agmodx plugins list and multilanguage files
@@ -114,6 +114,7 @@ jobs:
114114
echo 'linux addons/amxmodx/dlls/amxmodx_mm_i386.so' > agmodx-dev-linux/valve/addons/metamod/plugins.ini
115115
echo 'win32 addons/amxmodx/dlls/amxmodx_mm.dll' > agmodx-dev-windows/valve/addons/metamod/plugins.ini
116116
117+
# Create liblist.gam file
117118
liblist='// Valve Game Info file'
118119
liblist+='\n// These are key/value pairs. Certain mods will use different settings.'
119120
liblist+='\ngame "Half-Life"'
@@ -126,15 +127,22 @@ jobs:
126127
liblist+='\nsecure "1"'
127128
liblist+='\ntype "singleplayer_only"'
128129
129-
# Create liblist.gam file
130130
echo -e $liblist > agmodx-dev-linux/valve/liblist.gam
131131
echo -e $liblist > agmodx-dev-windows/valve/liblist.gam
132-
- name: Upload agmodx-dev artifacts for Linux
132+
133+
# Remove unnecessary files
134+
rm -r agmodx-dev-linux/valve/addons/amxmodx/scripting
135+
rm -r agmodx-dev-windows/valve/addons/amxmodx/scripting
136+
137+
- name: Upload AG Mod X package for Linux
133138
uses: actions/upload-artifact@master
134139
with:
135140
name: agmodx-dev-linux
136141
path: agmodx-dev-linux
137-
- name: Upload agmodx-dev artifacts for Windows
142+
143+
# TODO: maybe I should in the name of the artifact the branch and short commit SHA
144+
# More info: https://stackoverflow.com/questions/58886293/getting-current-branch-and-commit-hash-in-github-action
145+
- name: Upload AG Mod X package for Windows
138146
uses: actions/upload-artifact@master
139147
with:
140148
name: agmodx-dev-windows

0 commit comments

Comments
 (0)