Skip to content

Commit 8f71482

Browse files
authored
feat(ci): game server update checker (#4298)
* refactor: shorten module update function names The commit renames the update functions for several game modules to shorter names. The new names are more concise and easier to remember, which should improve code readability and maintainability. * feat: Add Update Check workflow This commit adds a new GitHub Actions workflow that checks if LinuxGSM is picking up game server config and parameter variables. The workflow runs on push and manual triggers, with concurrency settings to cancel in-progress jobs. It downloads linuxgsm.sh, installs dependencies, grabs the server, enables developer mode, installs the server, and updates it. * feat: Add concurrency group names to workflows The `details-check.yml` and `update-check.yml` workflows now have a concurrency group name that includes the branch or tag name. This will allow for better management of concurrent workflow runs. * refactor: Update script names for Minecraft, Factorio, Jedi Knight 2 and Vintage Story This commit updates the script names for Minecraft, Factorio, Jedi Knight 2 and Vintage Story. The update includes changes to command_check_update.sh, command_update.sh, core_functions.sh and install_server_files.sh. The new script names are update_mc.sh (formerly update_minecraft.sh), update_fctr.sh (formerly update_factorio.sh), update_jk2.sh (formerly update_jediknight2.sh) and update_vints.sh (formerly update_vintagestory.sh). * feat: Add support for 32-bit architecture This commit adds support for 32-bit architecture by running the command "sudo dpkg --add-architecture i386" instead of installing libxml2-utils and jq. * feat: Add i386 architecture and install libstdc++6 This commit adds the installation of libstdc++6:i386 package to support 32-bit applications. It also includes adding the i386 architecture to dpkg. * feat: Update dependencies for LinuxGSM Changed the dependency from libstdc++6:i386 to libgcc-s1:i386 in the update-check.yml file. This change was made to ensure compatibility with newer versions of LinuxGSM. * feat: Add update and force-update server functionality This commit adds the ability to check for updates and force updates on a server. The update-check.yml file has been modified to include new jobs that run the LGSM_GITHUBBRANCH command with specific arguments. * feat: Add dependencies for server installation This commit adds the necessary dependencies to install a game server. The `update-check.yml` file has been updated to include the installation of `bsdmainutils`, `libsdl2-2.0-0:i386`, `libtinfo5:i386`, and `steamcmd`. * steamcmd only * steamcmd * test * test * refactor: improve random password generation in install_config.sh The code change refactors the random password generation in the `install_config.sh` file. Instead of using `tr -dc A-Za-z0-9_ < /dev/urandom | head -c 8 | xargs`, it now uses `tr -dc 'A-Za-z0-9_' < /dev/urandom 2>/dev/null | head -c 8 | xargs`. This change improves the reliability and security of generating random passwords. * refactor: remove redundant code and set default branch The commit refactors the code by removing redundant code that sets the branch to "public" if no custom branch is specified. This change simplifies the logic and improves readability. * test * fix: fix steamcmd build version retrieval The code changes in this commit fix an issue with retrieving the build version from SteamCMD. The previous implementation was not correctly capturing the buildid. This has been resolved by adding additional echo statements for debugging purposes. * test fix: remove unnecessary app_info_print command The commit removes the unnecessary `app_info_print` command from the code. This command was not needed to check the buildid. * fix: GitHub Actions test failure The code change fixes a failing GitHub Actions test by running SteamCMD twice. The first run is to update the app info, and the second run retrieves the build ID for the specified branch. * Add steam user and password secret for jk2 * refactor: update steamuser and steampass paths in jk2server config The code changes refactor the paths for `steamuser` and `steampass` in the configuration file of the `jk2server`. The previous paths were incorrect, so they have been updated to point to the correct location. * refactor: update steamuser and steampass insertion in LGSM configuration The code changes refactor the way steamuser and steampass are inserted into the LGSM configuration file. Instead of hardcoding the values, they are now dynamically inserted using environment variables. This improves flexibility and security when setting up the server. * refactor: simplify steamuser and steampass insertion in update-check.yml The code changes remove unnecessary sed commands and replace them with a single echo command to insert the values of STEAMCMD_USER and STEAMCMD_PASS into the common.cfg file. This simplifies the code and improves readability. * feat: update steamuser and steampass in common.cfg The commit updates the code to properly insert the `steamuser` and `steampass` values in the `common.cfg` file. The previous code was not correctly formatting the values, which caused issues with server installation. This change ensures that the values are properly formatted using double quotes for `steamuser` and single quotes for `steampass`.
1 parent 16c4493 commit 8f71482

15 files changed

+93
-43
lines changed

.github/workflows/details-check.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55
push:
66

77
concurrency:
8-
group: ${{ github.ref_name }}
8+
group: details-check-${{ github.ref_name }}
99
cancel-in-progress: true
1010

1111
jobs:

.github/workflows/update-check.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Update Check
2+
# This action will check that LinuxGSM is picking up game server config and parameter variables.
3+
on:
4+
workflow_dispatch:
5+
push:
6+
7+
concurrency:
8+
group: update-check-${{ github.ref_name }}
9+
cancel-in-progress: true
10+
11+
jobs:
12+
update-check:
13+
continue-on-error: true
14+
runs-on: ubuntu-latest
15+
16+
strategy:
17+
matrix:
18+
shortname: [css, fctr, jk2, mc, mcb, mta, pmc, ts3, ut99, vints]
19+
20+
steps:
21+
- name: Download linuxgsm.sh
22+
run: wget https://raw.githubusercontent.com/GameServerManagers/LinuxGSM/${GITHUB_REF#refs/heads/}/linuxgsm.sh; chmod +x linuxgsm.sh
23+
24+
- name: Install dependencies
25+
run: sudo dpkg --add-architecture i386; sudo apt-get update;
26+
27+
- name: Grab server
28+
run: LGSM_GITHUBBRANCH="${GITHUB_REF#refs/heads/}" ./linuxgsm.sh ${{ matrix.shortname }}server
29+
30+
- name: Enable developer mode
31+
run: LGSM_GITHUBBRANCH="${GITHUB_REF#refs/heads/}" ./${{ matrix.shortname }}server developer
32+
33+
- name: Insert steamuser
34+
if: matrix.shortname == 'jk2'
35+
run: echo -e "steamuser=\"${{ secrets.STEAMCMD_USER }}\"\nsteampass='${{ secrets.STEAMCMD_PASS }}'" > lgsm/config-lgsm/${{ matrix.shortname }}server/common.cfg
36+
37+
- name: Install server
38+
run: LGSM_GITHUBBRANCH="${GITHUB_REF#refs/heads/}" ./${{ matrix.shortname }}server auto-install
39+
40+
- name: Check Update server
41+
run: LGSM_GITHUBBRANCH="${GITHUB_REF#refs/heads/}" ./${{ matrix.shortname }}server check-update
42+
43+
- name: Update server
44+
run: LGSM_GITHUBBRANCH="${GITHUB_REF#refs/heads/}" ./${{ matrix.shortname }}server update
45+
46+
- name: Force Update server
47+
if: matrix.shortname == 'css'
48+
run: LGSM_GITHUBBRANCH="${GITHUB_REF#refs/heads/}" ./${{ matrix.shortname }}server force-update

lgsm/modules/command_check_update.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,19 @@ core_logs.sh
1717
if [ "${shortname}" == "ts3" ]; then
1818
update_ts3.sh
1919
elif [ "${shortname}" == "mc" ]; then
20-
update_minecraft.sh
20+
update_mc.sh
2121
elif [ "${shortname}" == "mcb" ]; then
22-
update_minecraft_bedrock.sh
22+
update_mcb.sh
2323
elif [ "${shortname}" == "pmc" ] || [ "${shortname}" == "vpmc" ] || [ "${shortname}" == "wmc" ]; then
24-
update_papermc.sh
24+
update_pmc.sh
2525
elif [ "${shortname}" == "fctr" ]; then
26-
update_factorio.sh
26+
update_fctr.sh
2727
elif [ "${shortname}" == "mta" ]; then
2828
update_mta.sh
2929
elif [ "${shortname}" == "jk2" ]; then
30-
update_jediknight2.sh
30+
update_jk2.sh
3131
elif [ "${shortname}" == "vints" ]; then
32-
update_vintagestory.sh
32+
update_vints.sh
3333
elif [ "${shortname}" == "ut99" ]; then
3434
update_ut99.sh
3535
else

lgsm/modules/command_update.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,19 @@ check_last_update.sh
1818
if [ "${shortname}" == "ts3" ]; then
1919
update_ts3.sh
2020
elif [ "${shortname}" == "mc" ]; then
21-
update_minecraft.sh
21+
update_mc.sh
2222
elif [ "${shortname}" == "mcb" ]; then
23-
update_minecraft_bedrock.sh
23+
update_mcb.sh
2424
elif [ "${shortname}" == "pmc" ] || [ "${shortname}" == "vpmc" ] || [ "${shortname}" == "wmc" ]; then
25-
update_papermc.sh
25+
update_pmc.sh
2626
elif [ "${shortname}" == "fctr" ]; then
27-
update_factorio.sh
27+
update_fctr.sh
2828
elif [ "${shortname}" == "mta" ]; then
2929
update_mta.sh
3030
elif [ "${shortname}" == "jk2" ]; then
31-
update_jediknight2.sh
31+
update_jk2.sh
3232
elif [ "${shortname}" == "vints" ]; then
33-
update_vintagestory.sh
33+
update_vints.sh
3434
elif [ "${shortname}" == "ut99" ]; then
3535
update_ut99.sh
3636
else

lgsm/modules/core_functions.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -640,17 +640,17 @@ update_ts3.sh() {
640640
fn_fetch_function
641641
}
642642

643-
update_minecraft.sh() {
643+
update_mc.sh() {
644644
functionfile="${FUNCNAME[0]}"
645645
fn_fetch_function
646646
}
647647

648-
update_minecraft_bedrock.sh() {
648+
update_mcb.sh() {
649649
functionfile="${FUNCNAME[0]}"
650650
fn_fetch_function
651651
}
652652

653-
update_papermc.sh() {
653+
update_pmc.sh() {
654654
functionfile="${FUNCNAME[0]}"
655655
fn_fetch_function
656656
}
@@ -660,12 +660,12 @@ update_mta.sh() {
660660
fn_fetch_function
661661
}
662662

663-
update_factorio.sh() {
663+
update_fctr.sh() {
664664
functionfile="${FUNCNAME[0]}"
665665
fn_fetch_function
666666
}
667667

668-
update_jediknight2.sh() {
668+
update_jk2.sh() {
669669
functionfile="${FUNCNAME[0]}"
670670
fn_fetch_function
671671
}
@@ -675,7 +675,7 @@ update_steamcmd.sh() {
675675
fn_fetch_function
676676
}
677677

678-
update_vintagestory.sh() {
678+
update_vints.sh() {
679679
functionfile="${FUNCNAME[0]}"
680680
fn_fetch_function
681681
}

lgsm/modules/core_modules.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -645,17 +645,17 @@ update_ts3.sh() {
645645
fn_fetch_module
646646
}
647647

648-
update_minecraft.sh() {
648+
update_mc.sh() {
649649
modulefile="${FUNCNAME[0]}"
650650
fn_fetch_module
651651
}
652652

653-
update_minecraft_bedrock.sh() {
653+
update_mcb.sh() {
654654
modulefile="${FUNCNAME[0]}"
655655
fn_fetch_module
656656
}
657657

658-
update_papermc.sh() {
658+
update_pmc.sh() {
659659
modulefile="${FUNCNAME[0]}"
660660
fn_fetch_module
661661
}
@@ -665,12 +665,12 @@ update_mta.sh() {
665665
fn_fetch_module
666666
}
667667

668-
update_factorio.sh() {
668+
update_fctr.sh() {
669669
modulefile="${FUNCNAME[0]}"
670670
fn_fetch_module
671671
}
672672

673-
update_jediknight2.sh() {
673+
update_jk2.sh() {
674674
modulefile="${FUNCNAME[0]}"
675675
fn_fetch_module
676676
}
@@ -680,7 +680,7 @@ update_steamcmd.sh() {
680680
fn_fetch_module
681681
}
682682

683-
update_vintagestory.sh() {
683+
update_vints.sh() {
684684
modulefile="${FUNCNAME[0]}"
685685
fn_fetch_module
686686
}

lgsm/modules/core_steamcmd.sh

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -151,11 +151,6 @@ fn_update_steamcmd_localbuild() {
151151
# Uses appmanifest to find local build.
152152
localbuild=$(grep buildid "${appmanifestfile}" | tr '[:blank:]"' ' ' | tr -s ' ' | cut -d\ -f3)
153153

154-
# Set branch to public if no custom branch.
155-
if [ -z "${branch}" ]; then
156-
branch="public"
157-
fi
158-
159154
# Checks if localbuild variable has been set.
160155
if [ -z "${localbuild}" ]; then
161156
fn_print_fail "Checking local build: ${remotelocation}: missing local build info"
@@ -178,6 +173,13 @@ fn_update_steamcmd_remotebuild() {
178173
find "${HOME}" -type f -name "appinfo.vdf" -exec rm -f {} \; 2> /dev/null
179174
fi
180175

176+
# Set branch to public if no custom branch.
177+
if [ -z "${branch}" ]; then
178+
branch="public"
179+
fi
180+
181+
# added as was failing GitHub Actions test. Running SteamCMD twice seems to fix it.
182+
${steamcmdcommand} +login "${steamuser}" "${steampass}" +app_info_update 1 +quit 2> /dev/null
181183
# password for branch not needed to check the buildid
182184
remotebuildversion=$(${steamcmdcommand} +login "${steamuser}" "${steampass}" +app_info_update 1 +app_info_print "${appid}" +quit | sed -e '/"branches"/,/^}/!d' | sed -n "/\"${branch}\"/,/}/p" | grep -m 1 buildid | tr -cd '[:digit:]')
183185

lgsm/modules/install_config.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ fn_default_config_local() {
6464
# PASSWORD to random password
6565
fn_set_config_vars() {
6666
if [ -f "${servercfgfullpath}" ]; then
67-
random=$(tr -dc A-Za-z0-9_ < /dev/urandom | head -c 8 | xargs)
67+
random=$(tr -dc 'A-Za-z0-9_' < /dev/urandom 2>/dev/null | head -c 8 | xargs)
6868
servername="LinuxGSM"
6969
rconpass="admin${random}"
7070
echo -e "changing hostname."

lgsm/modules/install_server_files.sh

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -221,23 +221,23 @@ if [ "${shortname}" == "ts3" ]; then
221221
update_ts3.sh
222222
elif [ "${shortname}" == "mc" ]; then
223223
install_eula.sh
224-
update_minecraft.sh
224+
update_mc.sh
225225
elif [ "${shortname}" == "mcb" ]; then
226-
update_minecraft_bedrock.sh
226+
update_mcb.sh
227227
elif [ "${shortname}" == "pmc" ]; then
228228
install_eula.sh
229-
update_papermc.sh
229+
update_pmc.sh
230230
elif [ "${shortname}" == "wmc" ] || [ "${shortname}" == "vpmc" ]; then
231-
update_papermc.sh
231+
update_pmc.sh
232232
elif [ "${shortname}" == "mta" ]; then
233233
update_mta.sh
234234
elif [ "${shortname}" == "fctr" ]; then
235-
update_factorio.sh
235+
update_fctr.sh
236236
install_factorio_save.sh
237237
elif [ "${shortname}" == "jk2" ]; then
238-
update_jediknight2.sh
238+
update_jk2.sh
239239
elif [ "${shortname}" == "vints" ]; then
240-
update_vintagestory.sh
240+
update_vints.sh
241241
elif [ "${shortname}" == "ut99" ]; then
242242
fn_install_server_files
243243
update_ut99.sh

lgsm/modules/update_factorio.sh renamed to lgsm/modules/update_fctr.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/bin/bash
2-
# LinuxGSM update_factorio.sh module
2+
# LinuxGSM update_fctr.sh module
33
# Author: Daniel Gibbs
44
# Contributors: http://linuxgsm.com/contrib
55
# Website: https://linuxgsm.com

0 commit comments

Comments
 (0)