Skip to content

Commit

Permalink
Merge branch 'master' of github.com:RGLgg/server-resources-updater in…
Browse files Browse the repository at this point in the history
…to beta
  • Loading branch information
l-Aad-l committed Mar 31, 2024
2 parents db575ad + 9f55b61 commit 5355e1a
Show file tree
Hide file tree
Showing 7 changed files with 311 additions and 5 deletions.
218 changes: 218 additions & 0 deletions .github/workflows/branches.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,218 @@
name: Branch Build

on:
push:
branches-ignore:
- master
- beta

jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
SM_VERSION: ["1.10"]

steps:
- uses: actions/checkout@v2

- name: Set environment variables
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
run: |
git fetch --unshallow
VERSION=$(git rev-list --count HEAD)
SHORT=$(git describe --always --long --dirty)
SOURCEMOD_PATH=$GITHUB_WORKSPACE/addons/sourcemod
CONFIG_PATH=$GITHUB_WORKSPACE/cfg
echo ::set-env name=GIT_COMMIT::$VERSION
echo ::set-env name=PLUGIN_VERSION::${{ matrix.SM_VERSION }}.$VERSION.$SHORT
echo ::set-env name=WORKSPACE::$GITHUB_WORKSPACE
echo ::set-env name=CONFIG_PATH::$CONFIG_PATH
echo ::set-env name=SOURCEMOD_PATH::$SOURCEMOD_PATH
echo ::set-env name=SCRIPTS_PATH::$SOURCEMOD_PATH/scripting
echo ::set-env name=PLUGINS_PATH::$SOURCEMOD_PATH/plugins
- name: Get latest version of SteamWorks Windows+Linux
run: |
wget -q -O tmp.zip http://users.alliedmods.net/~kyles/builds/SteamWorks/SteamWorks-git132-windows.zip && unzip -o tmp.zip 'addons/*' -d ../../ && rm tmp.zip
wget -q -O tmp.tar.gz http://users.alliedmods.net/~kyles/builds/SteamWorks/SteamWorks-git132-linux.tar.gz && tar -xvzf tmp.tar.gz --strip-components=2 && rm tmp.tar.gz
working-directory: ${{ env.SOURCEMOD_PATH }}/

# TF2 Comp Fixes: https://github.com/ldesgoui/tf2-comp-fixes
# Dhooks2 wget link needs to be updated every time DHooks2 receives an update as their download URL(detour*-sm110) changes on each release
# Removed updating to latest tf2-comp-fixes due to issues with windows servers
# wget -q -O tmp.zip https://github.com/ldesgoui/tf2-comp-fixes/releases/latest/download/tf2-comp-fixes.zip && unzip -o tmp.zip -d ../../ && rm tmp.zip
- name: Get latest version of TF2 Comp Fixes and its DHooks dependency
run: |
wget -q -O tmp.zip https://github.com/ldesgoui/tf2-comp-fixes/releases/download/v1.16.12/tf2-comp-fixes.zip && unzip -o tmp.zip -d ../../ && rm tmp.zip
wget -q -O tmp.zip https://github.com/peace-maker/DHooks2/releases/download/v2.2.0-detours17/dhooks-2.2.0-detours17-sm110.zip && unzip -o tmp.zip -d ../../ && rm tmp.zip
working-directory: ${{ env.SOURCEMOD_PATH }}/

# SrcTV+: https://github.com/dalegaard/srctvplus
- name: Get latest version of SrcTV+
run: |
wget -q -O addons/srctvplus.dll https://github.com/dalegaard/srctvplus/releases/latest/download/srctvplus.dll
wget -q -O addons/srctvplus.so https://github.com/dalegaard/srctvplus/releases/latest/download/srctvplus.so
wget -q -O addons/srctvplus.vdf https://github.com/dalegaard/srctvplus/releases/latest/download/srctvplus.vdf
working-directory: ${{ env.WORKSPACE }}/

# TF2 Halftime: https://github.com/stephanieLGBT/tf2-halftime
- name: Get latest version of TF2 Halftime
run: |
wget -q -O scripting/include/morecolors.inc https://raw.githubusercontent.com/stephanieLGBT/tf2-halftime/master/scripting/include/morecolors.inc
wget -q -O scripting/tf2Halftime.sp https://raw.githubusercontent.com/stephanieLGBT/tf2-halftime/master/scripting/tf2Halftime.sp
working-directory: ${{ env.SOURCEMOD_PATH }}/

# Color Literals: https://github.com/JoinedSenses/SourceMod-IncludeLibrary/blob/master/include/color_literals.inc
- name: Get latest version of Color Literals
run: |
wget -q -O scripting/include/color_literals.inc https://raw.githubusercontent.com/JoinedSenses/SourceMod-IncludeLibrary/master/include/color_literals.inc
working-directory: ${{ env.SOURCEMOD_PATH }}/

- name: Get latest whitelists for each format
run: |
wget -q -O rgl_whitelist_6s.txt https://whitelist.tf/rgl_6v6.txt
wget -q -O rgl_whitelist_HL.txt https://whitelist.tf/rgl_9v9.txt
wget -q -O rgl_whitelist_mm.txt https://whitelist.tf/rgl_nr6s.txt
wget -q -O rgl_whitelist_7s.txt https://whitelist.tf/rgl_7v7.txt
wget -q -O rgl_whitelist_pt.txt https://whitelist.tf/rgl_passtime.txt
wget -q -O rgl_whitelist_ud.txt https://whitelist.tf/rgl_ultiduo.txt
wget -q -O rgl_whitelist_6s_cups.txt https://whitelist.tf/custom_whitelist_14183.txt
working-directory: ${{ env.CONFIG_PATH }}/

- name: Validate whitelists for each format
run: |
sixes_lines=$(wc -l < rgl_whitelist_6s.txt)
hl_lines=$(wc -l < rgl_whitelist_HL.txt)
mm_lines=$(wc -l < rgl_whitelist_mm.txt)
pl_lines=$(wc -l < rgl_whitelist_7s.txt)
sixes_lines=$(wc -l < rgl_whitelist_6s.txt)
passtime_lines=$(wc -l < rgl_whitelist_pt.txt)
ultiduo_lines=$(wc -l < rgl_whitelist_ud.txt)
if [[ $sixes_lines -le 50 ]];
then
echo "Sixes: Number of lines is less than 50."
exit 1
elif [[ $hl_lines -le 50 ]]
then
echo "HL: Number of lines is less than 50."
exit 1
elif [[ $mm_lines -le 50 ]]
then
echo "MM: Number of lines is less than 50."
exit 1
elif [[ $pl_lines -le 50 ]]
then
echo "PL: Number of lines is less than 50."
exit 1
elif [[ $passtime_lines -le 50 ]]
then
echo "PT: Number of lines is less than 50."
exit 1
elif [[ $ultiduo_lines -le 50 ]]
then
echo "PT: Number of lines is less than 50."
exit 1
fi
echo "Whitelist Checks Complete"
working-directory: ${{ env.CONFIG_PATH }}/

- name: Setup SourcePawn Compiler ${{ matrix.SM_VERSION }}
id: setup-sp
uses: rumblefrog/setup-sp@master
with:
version: ${{ matrix.SM_VERSION }}

- name: Compile RGL Suite Plugins against SM ${{ steps.setup-sp.outputs.version }}
run: |
for plugin in "rglqol" "rglupdater" "config_checker" "tf2Halftime" "improved_match_timer" "disabled/roundtimer_override"
do
echo -e "\nCompiling $plugin.sp..."
spcomp -E -w234 -O2 -v2 -i $SCRIPTS_PATH/include $plugin.sp
done
working-directory: ${{ env.SCRIPTS_PATH }}/

# Updated Pause Plugin: https://github.com/l-Aad-l/updated-pause-plugin
- name: Get latest version of Updated Pause Plugin
run: |
wget -q -O tmp.zip https://github.com/l-Aad-l/updated-pause-plugin/releases/latest/download/updated-pause-plugin.zip && unzip -o tmp.zip 'addons/*' -d ../../ && rm tmp.zip
working-directory: ${{ env.SOURCEMOD_PATH }}/

# Updated Updater: https://git.empiresmod.com/sourcemod/Updater
- name: Get latest version of Updater
run: |
wget -q -O tmp.zip https://git.empiresmod.com/sourcemod/Updater/-/jobs/artifacts/master/download?job=build && unzip -o tmp.zip 'addons/*' -d ../../ && rm tmp.zip
working-directory: ${{ env.SOURCEMOD_PATH }}/

# PASS Time plugins
- name: Get latest version of PASS Time Plugin
run: |
mkdir -p addons/sourcemod/plugins
wget -q -O $PLUGINS_PATH/p4sstime.smx https://github.com/blakeplusplus/p4sstime/releases/latest/download/p4sstime.smx
wget -q -O tmp.zip https://github.com/blakeplusplus/p4sstime/archive/refs/heads/main.zip && first_folder=$(unzip -Z1 tmp.zip | awk -F/ '{print $1}' | head -n 1) && unzip -q tmp.zip "$first_folder/*" -d "passtime" && cd passtime/$first_folder && cp -r addons/sourcemod/gamedata ../../addons/sourcemod/ && cd ../../ && rm -rf passtime && rm tmp.zip
working-directory: ${{ env.SOURCEMOD_PATH }}/

- name: Move compiled plugins
run: |
rm -rf $PLUGINS_PATH/disabled/
mkdir -p $PLUGINS_PATH/disabled/
rsync -av --include='*/' --include="*.smx" --exclude="*" --prune-empty-dirs --remove-source-files $SCRIPTS_PATH/ $PLUGINS_PATH/
ls
- name: Disable optional plugins
run: |
mv tf2Halftime.smx disabled/
mv roundtimer_override.smx disabled/
mv p4sstime.smx disabled/
working-directory: ${{ env.PLUGINS_PATH }}/

- name: Rebuild updatefile.txt
run: |
FILES=$(find ./cfg ./addons -type f \
| sed "s|^\.||" \
| sed 's/ / \\ /' \
| sed 's/^/"/;s/$/"/' \
| sed '/regex/G' \
) \
;
find . -name "updatefile-template.txt" -type f -exec cp {} ./updatefile.txt \;
for FILE in $FILES
do
if [[ "$FILE" != *"_custom.cfg"* ]];
then
if [[ $FILE == *"scripting"* ]];
then
echo $' "Source" ' $FILE
else
echo $' "Plugin" ' $FILE
fi
fi
done >> updatefile.txt
echo $' }' >> updatefile.txt
echo $'}' >> updatefile.txt
working-directory: ${{ env.WORKSPACE }}/

- name: Move folders (addons, cfg) to build
run: |
mkdir build
mv ./{addons,cfg} build/
- name: Add updatefile.txt, README.md to build package
run: |
mv $GITHUB_WORKSPACE/{updatefile.txt,README.md} .
working-directory: ./build

- name: Upload plugin artifact
uses: actions/upload-artifact@master
if: ${{ always() }}
with:
name: Plugin.${{ env.PLUGIN_VERSION }}
path: build/
10 changes: 9 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ jobs:

- name: Compile RGL Suite Plugins against SM ${{ steps.setup-sp.outputs.version }}
run: |
for plugin in "rglqol" "rglupdater" "tf2Halftime" "improved_match_timer" "disabled/roundtimer_override"
for plugin in "rglqol" "rglupdater" "config_checker" "tf2Halftime" "improved_match_timer" "disabled/roundtimer_override"
do
echo -e "\nCompiling $plugin.sp..."
spcomp -E -w234 -O2 -v2 -i $SCRIPTS_PATH/include $plugin.sp
Expand All @@ -147,6 +147,14 @@ jobs:
wget -q -O tmp.zip https://git.empiresmod.com/sourcemod/Updater/-/jobs/artifacts/master/download?job=build && unzip -o tmp.zip 'addons/*' -d ../../ && rm tmp.zip
working-directory: ${{ env.SOURCEMOD_PATH }}/

# PASS Time plugins
- name: Get latest version of PASS Time Plugin
run: |
mkdir -p addons/sourcemod/plugins
wget -q -O ../../addons/sourcemod/plugins/p4sstime.smx https://github.com/blakeplusplus/p4sstime/releases/latest/download/p4sstime.smx
wget -q -O tmp.zip https://github.com/blakeplusplus/p4sstime/archive/refs/heads/main.zip && first_folder=$(unzip -Z1 tmp.zip | awk -F/ '{print $1}' | head -n 1) && unzip -q tmp.zip "$first_folder/*" -d "passtime" && cd passtime/$first_folder && cp -r addons/sourcemod/gamedata ../../addons/sourcemod/ && cd ../../ && rm -rf passtime && rm tmp.zip
working-directory: ${{ env.SOURCEMOD_PATH }}/

- name: Move compiled plugins
run: |
rm -rf $PLUGINS_PATH/disabled/
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:

- name: Compile RGL Suite Plugins against SM ${{ steps.setup-sp.outputs.version }}
run: |
for plugin in "rglqol" "rglupdater" "improved_match_timer" "disabled/roundtimer_override"
for plugin in "rglqol" "rglupdater" "config_checker" "improved_match_timer" "disabled/roundtimer_override"
do
echo -e "\nCompiling $plugin.sp..."
spcomp -E -w234 -O2 -v2 -i $SCRIPTS_PATH/include $plugin.sp
Expand All @@ -67,7 +67,6 @@ jobs:
- name: Disable optional plugins
run: |
mv roundtimer_override.smx disabled/
mv p4sstime.smx disabled/
working-directory: ${{ env.PLUGINS_PATH }}/

- name: Rebuild updatefile.txt
Expand Down
10 changes: 9 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ jobs:

- name: Compile RGL Suite Plugins against SM ${{ steps.setup-sp.outputs.version }}
run: |
for plugin in "rglqol" "rglupdater" "tf2Halftime" "improved_match_timer" "disabled/roundtimer_override"
for plugin in "rglqol" "rglupdater" "config_checker" "tf2Halftime" "improved_match_timer" "disabled/roundtimer_override"
do
echo -e "\nCompiling $plugin.sp..."
spcomp -E -w234 -O2 -v2 -i $SCRIPTS_PATH/include $plugin.sp
Expand All @@ -110,6 +110,14 @@ jobs:
wget -q -O tmp.zip https://git.empiresmod.com/sourcemod/Updater/-/jobs/artifacts/master/download?job=build && unzip -o tmp.zip 'addons/*' -d ../../ && rm tmp.zip
working-directory: ${{ env.SOURCEMOD_PATH }}/

# PASS Time plugins
- name: Get latest version of PASS Time Plugin
run: |
mkdir -p addons/sourcemod/plugins
wget -q -O ../../addons/sourcemod/plugins/p4sstime.smx https://github.com/blakeplusplus/p4sstime/releases/latest/download/p4sstime.smx
wget -q -O tmp.zip https://github.com/blakeplusplus/p4sstime/archive/refs/heads/main.zip && first_folder=$(unzip -Z1 tmp.zip | awk -F/ '{print $1}' | head -n 1) && unzip -q tmp.zip "$first_folder/*" -d "passtime" && cd passtime/$first_folder && cp -r addons/sourcemod/gamedata ../../addons/sourcemod/ && cd ../../ && rm -rf passtime && rm tmp.zip
working-directory: ${{ env.SOURCEMOD_PATH }}/

- name: Move compiled plugins
run: |
rm -rf $PLUGINS_PATH/disabled/
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ README.txt

# ignore smx builds
*.smx
!p4sstime.smx
#!p4sstime.smx

Binary file removed addons/sourcemod/plugins/p4sstime.smx
Binary file not shown.
72 changes: 72 additions & 0 deletions addons/sourcemod/scripting/config_checker.sp
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
#pragma newdecls required
#pragma semicolon 1

#include <sourcemod>

#define PLUGIN_NAME "Config Checker"
#define PLUGIN_VERSION "1.0.0"
char cfgVal[128];

public Plugin myinfo =
{
name = PLUGIN_NAME,
author = "Aad",
description = "Prints executed config file to client and chat",
version = PLUGIN_VERSION,
url = "https://github.com/RGLgg/server-resources-updater"
}

public void OnPluginStart()
{
LogMessage("[CC] version %s has been loaded.", PLUGIN_VERSION);
PrintToChatAll("[CC] version %s has been loaded.", PLUGIN_VERSION);
RegConsoleCmd("cc", Config_Info, "!cc - Prints Config name to client");
GetConVarString(FindConVar("servercfgfile"), cfgVal, sizeof(cfgVal));
HookConVarChange(FindConVar("servercfgfile"), OnServerCfgChanged);
HookEvent("teamplay_round_start", EventRoundStart);
}

public Action Config_Info(int client, int args)
{
ReplyToCommand(client, "[CC] This server is running config: %s", cfgVal);
return Plugin_Handled;
}

public Action EventRoundStart(Handle event, const char[] name, bool dontBroadcast)
{
PrintToAll();
return Plugin_Continue;
}

public void OnServerCfgChanged(ConVar convar, char[] oldValue, char[] newValue)
{
PrintToAll();
}

public void OnClientPostAdminCheck(int client)
{
GetConVarString(FindConVar("servercfgfile"), cfgVal, sizeof(cfgVal));
CreateTimer(15.0, prWelcomeClient, GetClientUserId(client), TIMER_FLAG_NO_MAPCHANGE);
}

public Action prWelcomeClient(Handle timer, int userid)
{
int client = GetClientOfUserId(userid);
if (client)
{
PrintToChat(client, "[CC] This server is running config: %s", cfgVal);
}

return Plugin_Continue;
}

public void PrintToAll() {
GetConVarString(FindConVar("servercfgfile"), cfgVal, sizeof(cfgVal));
PrintToChatAll("[CC] This server is running config: %s", cfgVal);
}

public void OnPluginEnd()
{
LogMessage("[CC] version %s has been unloaded.", PLUGIN_VERSION);
PrintToChatAll("[CC] version %s has been unloaded.", PLUGIN_VERSION);
}

0 comments on commit 5355e1a

Please sign in to comment.