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

@ -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"