1
- name : AG Mod X - Full Package Release
1
+ name : AG Mod X - Full release package
2
2
3
3
on :
4
4
push :
5
5
pull_request :
6
6
7
7
jobs :
8
8
build :
9
-
10
9
runs-on : ubuntu-latest
11
-
10
+
12
11
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
19
16
run : |
17
+ wget "https://www.amxmodx.org/latest.php?version=1.9&os=linux&package=base" -O amxx-linux.tar.gz
20
18
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
22
21
unzip amxx-windows.zip -d amxx-windows
23
- - name : Download Metamod v1.21p39 (Solokiller)
22
+
23
+ - name : Download Metamod-P v1.21p39
24
24
run : |
25
25
wget "https://github.com/Solokiller/Metamod-P-CMake/releases/download/v1.21p39/Metamod-P-opt-fast-Linux.zip" -O metamod.zip
26
26
wget "https://github.com/Solokiller/Metamod-P-CMake/releases/download/v1.21p39/Metamod-P-opt-fast.zip" -O metamod-win.zip
27
27
unzip metamod.zip
28
28
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)
35
29
36
- # Creating agmodx release folder structure (Windows and linux)
30
+ - name : Create AG Mod X folder structure for Windows and Linux
31
+ run : |
37
32
os=("agmodx-dev-linux" "agmodx-dev-windows")
38
33
for i in "${os[@]}"
39
34
do
40
35
mkdir $i && cd $i && mkdir valve && cd valve
41
36
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
45
39
done
46
40
41
+ - name : Copy necessary files for compiling
42
+ run : |
47
43
# 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
49
45
cp -a amxx-windows/addons/* agmodx-dev-windows/valve/addons
50
46
51
47
# In case the repository has an include folder, we copy the dependencies
52
48
if [ -d valve/addons/amxmodx/scripting/include ]; then
53
49
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
55
51
fi
56
52
57
53
# 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
59
55
56
+ - name : Compile plugins
57
+ run : |
60
58
# 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
62
63
63
64
# 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
65
66
do
66
67
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")
69
70
done
70
71
71
- # Returning again to the location where we were before
72
- cd $previousDir
72
+ # Return to initial location
73
+ cd $GITHUB_WORKSPACE
73
74
74
- # Copy compiled plugins to windows artifact
75
+ # Copy compiled plugins to the windows artifact
75
76
cp -a agmodx-dev-linux/valve/addons/amxmodx/plugins/*.amxx agmodx-dev-windows/valve/addons/amxmodx/plugins
76
77
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")
81
81
for systems in "${os[@]}"
82
82
do
83
83
# Copy agmodx plugins list and multilanguage files
@@ -114,6 +114,7 @@ jobs:
114
114
echo 'linux addons/amxmodx/dlls/amxmodx_mm_i386.so' > agmodx-dev-linux/valve/addons/metamod/plugins.ini
115
115
echo 'win32 addons/amxmodx/dlls/amxmodx_mm.dll' > agmodx-dev-windows/valve/addons/metamod/plugins.ini
116
116
117
+ # Create liblist.gam file
117
118
liblist='// Valve Game Info file'
118
119
liblist+='\n// These are key/value pairs. Certain mods will use different settings.'
119
120
liblist+='\ngame "Half-Life"'
@@ -126,15 +127,22 @@ jobs:
126
127
liblist+='\nsecure "1"'
127
128
liblist+='\ntype "singleplayer_only"'
128
129
129
- # Create liblist.gam file
130
130
echo -e $liblist > agmodx-dev-linux/valve/liblist.gam
131
131
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
133
138
uses : actions/upload-artifact@master
134
139
with :
135
140
name : agmodx-dev-linux
136
141
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
138
146
uses : actions/upload-artifact@master
139
147
with :
140
148
name : agmodx-dev-windows
0 commit comments