Change the way that Vintage Story API is added to the CI server

This commit is contained in:
zontreck 2025-06-29 10:21:41 -07:00
parent c3ec58dbb5
commit 6a235366e5
5 changed files with 92 additions and 17 deletions

View file

@ -1,17 +1,9 @@
FROM git.zontreck.com/packages/appimage:latest AS BUILDER
WORKDIR /
RUN wget https://cdn.vintagestory.at/gamefiles/stable/vs_server_linux-x64_1.20.12.tar.gz
WORKDIR /vintagestory
RUN tar -xvf /vs_server_linux-x64_1.20.12.tar.gz && rm /*.tar.gz
FROM git.zontreck.com/packages/appimage:latest
ENV PUB NAN
ENV AGENT NAN
LABEL VS_API 1.20.12
ENV VSAPI 1
LABEL VINTAGESTORY API is available
WORKDIR /
ADD ./entrypoint.sh /entrypoint.sh
@ -19,9 +11,16 @@ RUN chmod +x /entrypoint.sh
WORKDIR /root/.local/share
COPY --from=BUILDER --chown=root:root /vintagestory ./vintagestory
ADD ./update_vs_dotgame /bin/update_vs_dotgame
RUN chmod +x /bin/update_vs_dotgame
ADD ./dlvs.sh /bin/dlvs
ADD ./pullvs.sh /bin/pullvs
ADD ./mkdotgame /bin/mkdotgame
# Bootstrap all the commonly used Vintage Story versions
RUN chmod +x /bin/mkdotgame && \
ln -sfv /bin/mkdotgame /bin/update_vs_dotgame && \
chmod +x /bin/dlvs && chmod +x /bin/pullvs && \
pullvs
ENTRYPOINT [ "/bin/bash", "/entrypoint.sh" ]

View file

@ -0,0 +1,34 @@
#!/bin/bash
# Function to download game files based on version
download_game() {
local version=$1
local url
local extract_path="/vintagestory_${version}"
# Check if version contains a "-"
if [[ $version == *"-"* ]]; then
url="https://cdn.vintagestory.at/gamefiles/unstable/vs_server_linux-x64_${version}.tar.gz"
else
url="https://cdn.virtualstory.at/gamefiles/stable/vs_server_linux-x64_${version}.tar.gz"
fi
# Check if extract path already exists and is not empty
if [ -d "$extract_path" ] && [ ! -z "$(ls -A "$extract_path")" ]; then
echo "Extract path $extract_path already exists and is not empty, skipping download."
return
fi
# Download game files
download_path="/vs_server_linux-x64_${version}"
wget "$url" -O "${download_path}.tar.gz"
# Extract and clean up
cd $extract_path
tar -xvf "${download_path}.tar.gz" && rm "${download_path}"/"${version}"*.tar.gz
cd /
}
# Call the function with version as argument (e.g. "1.20.12")
download_game "$1"

8
LinuxGeneralCompiler/mkdotgame Executable file
View file

@ -0,0 +1,8 @@
#!/bin/bash
#
local version=$1
rm .game || true
dlvs $version || true
ln -sv "~/.local/share/vintagestory_${version}" .game

View file

@ -0,0 +1,38 @@
#!/bin/bash
# Function to download game files based on version
download_game() {
dlvs $1
}
# Call the function with version as argument (e.g. "1.20.12")
# Current Pre-release
download_game "1.21.0-pre.1"
# Releases
download_game "1.20.12"
download_game "1.20.11"
download_game "1.20.10"
download_game "1.20.9"
download_game "1.20.8"
download_game "1.20.7"
download_game "1.20.6"
download_game "1.20.5"
download_game "1.20.4"
download_game "1.20.3"
download_game "1.20.2"
download_game "1.20.1"
download_game "1.20.0"
download_game "1.19.8"
download_game "1.19.7"
download_game "1.19.6"
download_game "1.19.5"
download_game "1.19.4"
download_game "1.19.3"
download_game "1.19.2"
download_game "1.19.1"
download_game "1.19.0"
download_game "1.18.15"

View file

@ -1,4 +0,0 @@
#!/bin/bash
rm .game || true
ln -sv ~/.local/share/vintagestory .game