-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Get latest custom server release from github correctly
- Loading branch information
Showing
2 changed files
with
22 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,7 +16,7 @@ RUN wget -nv -q -O keepup.zip https://github.com/MineInAbyss/Keepup/releases/dow | |
|
||
FROM itzg/minecraft-server:java21-graalvm as minecraft | ||
LABEL org.opencontainers.image.authors="Offz <[email protected]>" | ||
RUN dnf install -y ansible-core rclone wget unzip jq openssh | ||
RUN dnf install -y ansible-core rclone wget unzip jq openssh attr | ||
COPY --from=helper /keepup /usr/local | ||
ENV\ | ||
KEEPUP=true\ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,26 @@ | ||
#!/bin/sh | ||
set -e | ||
|
||
if [ "$CUSTOM_SERVER_URL" ]; then | ||
if [ ! "$CUSTOM_SERVER" ]; then | ||
export CUSTOM_SERVER=server.jar | ||
PREFIX="[Download Server]" | ||
if [ "$CUSTOM_SERVER_REPO" ]; then | ||
[ ! "$CUSTOM_SERVER" ] && export CUSTOM_SERVER=./server.jar | ||
|
||
echo "$PREFIX Checking for server updates from $CUSTOM_SERVER_REPO" | ||
|
||
export LATEST_RELEASE_DATE=$(curl -s "https://api.github.com/repos/$CUSTOM_SERVER_REPO/releases/latest" | jq -r '.published_at' 2>/dev/null) | ||
export CURRENT_RELEASE_DATE=$(getfattr --only-values -n user.release-date "$CUSTOM_SERVER" 2>/dev/null) | ||
|
||
echo "$PREFIX Latest release date: $LATEST_RELEASE_DATE" | ||
echo "$PREFIX Current release date: $CURRENT_RELEASE_DATE" | ||
|
||
if [ "$LATEST_RELEASE_DATE" != "$CURRENT_RELEASE_DATE" ]; then | ||
echo "$PREFIX Downloading new release, release date: $LATEST_RELEASE_DATE" | ||
wget $(curl -s https://api.github.com/repos/$CUSTOM_SERVER_REPO/releases/latest | jq -r '.assets[] | select(.name | contains ("jar")) | .browser_download_url')\ | ||
-q --show-progress -O "$CUSTOM_SERVER" | ||
|
||
setfattr -n user.release-date -v "$LATEST_RELEASE_DATE" "$CUSTOM_SERVER" | ||
chmod +x "$CUSTOM_SERVER" | ||
else | ||
echo "$PREFIX Server is up to date" | ||
fi | ||
echo "Checking for server updates from $CUSTOM_SERVER_URL" | ||
wget -N -q --show-progress "$CUSTOM_SERVER_URL" -c --output-document="$CUSTOM_SERVER" | ||
fi |