Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add version checking #498

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v0.32.0
1 change: 1 addition & 0 deletions scripts/VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v0.32.0
21 changes: 21 additions & 0 deletions scripts/helper_functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -259,3 +259,24 @@ countdown_message() {
fi
return "$return_val"
}

# Checks if the container is up to date, links to update documentation if an update is available
# Return 0 if the container is up to date
# Return 1 if there is a container update available
check_container_version() {
# Read the local version from the VERSION file
local current_version=$(head -n 1 /home/steam/server/VERSION)

# Query GitHub API to get the latest tag version
local latest_version=$(curl -s "https://api.github.com/repos/thijsvanloef/palworld-server-docker/releases/latest" | grep -oP '"tag_name": "\K[^"]+')

# Check if the local version is older than the latest version and link to documentation if not
if [[ "$current_version" != "$latest_version" ]]; then
echo "Your container image is outdated. Current Version is ${current_version}, Latest version is v${latest_version}."
echo -e "See '\e]8;;https://palworld-server-docker.loef.dev/guides/updating-container\ahttps://palworld-server-docker.loef.dev/guides/updating-container\e]8;;\a' for instructions on how to update."
local return_val=1
else
local return_val=0
fi
return "$return_val"
}
3 changes: 3 additions & 0 deletions scripts/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -184,3 +184,6 @@ echo "${STARTCOMMAND[*]}"

DiscordMessage "Stop" "${DISCORD_POST_SHUTDOWN_MESSAGE}" "failure" "${DISCORD_POST_SHUTDOWN_MESSAGE_ENABLED}" "${DISCORD_POST_SHUTDOWN_MESSAGE_URL}"
exit 0

# Temporarily adding here before we determine where in the sequence it should be added
check_container_version
Loading