From 56b772e383cc589a588fc17788df305377534922 Mon Sep 17 00:00:00 2001 From: Louis Capitanchik <contact@louiscap.co> Date: Fri, 15 Nov 2024 03:15:22 +0000 Subject: [PATCH] Include butler for itch.io uploads --- Dockerfile | 13 +++++++++++-- commands/butler_install.sh | 13 +++++++++++++ commands/butler_upload.sh | 10 ++++++++++ commands/godot_build_web.sh | 10 ++++++++++ commands/godot_project_title.sh | 5 +++++ 5 files changed, 49 insertions(+), 2 deletions(-) create mode 100755 commands/butler_install.sh create mode 100755 commands/butler_upload.sh create mode 100644 commands/godot_build_web.sh create mode 100755 commands/godot_project_title.sh diff --git a/Dockerfile b/Dockerfile index 0426594..0113801 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,12 +2,21 @@ FROM debian:12.8-slim ARG PLATFORM="linux.x86_64" ARG GODOT_VERSION="4.3-stable" +ARG BUTLER_VERSION="15.12.0" + +ENV BUTLER_API_KEY="" RUN apt-get update \ - && apt-get install -y wget unzip libfontconfig1 \ + && apt-get install -y wget zip unzip libfontconfig1 \ && rm -rf /var/lib/apt/lists/* COPY commands/godot_build.sh /usr/bin/godot_build +COPY commands/godot_build_web.sh /usr/bin/godot_build_web COPY commands/godot_install.sh /usr/bin/godot_install +COPY commands/godot_project_title.sh /usr/bin/godot_project_title + +COPY commands/butler_install.sh /usr/bin/butler_install +COPY commands/butler_upload.sh /usr/bin/butler_upload -RUN godot_install $GODOT_VERSION $PLATFORM && cp ./godot /usr/bin/godot \ No newline at end of file +RUN godot_install $GODOT_VERSION $PLATFORM && cp ./godot /usr/bin/godot +RUN butler_install $BUTLER_VERSION \ No newline at end of file diff --git a/commands/butler_install.sh b/commands/butler_install.sh new file mode 100755 index 0000000..2330e3d --- /dev/null +++ b/commands/butler_install.sh @@ -0,0 +1,13 @@ +#!/usr/bin/env bash + +BUTLER_VERSION="$1" +BUTLER_URL="https://broth.itch.ovh/butler/linux-amd64/${BUTLER_VERSION}/archive/default" + +mkdir -p /tmp/butler + +wget -L -O /tmp/butler/butler.zip "$BUTLER_URL" +unzip -d /tmp/butler /tmp/butler/butler.zip +chmod +x /tmp/butler/butler +mv /tmp/butler/butler /usr/bin/butler + +rm -r /tmp/butler \ No newline at end of file diff --git a/commands/butler_upload.sh b/commands/butler_upload.sh new file mode 100755 index 0000000..b5df0d7 --- /dev/null +++ b/commands/butler_upload.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash + +PROJECT_PATH="$1" +USERNAME=$(echo "$2" | cut -d "/" -f 1) +PROJECT_NAME=$(echo "$2" | cut -d "/" -f 2) +PLATFORM="$3" + +CHANNEL_NAME="${PROJECT_NAME}-${PLATFORM}" + +butler push "$PROJECT_PATH" "${USERNAME}/${PROJECT_NAME}:${CHANNEL_NAME}" \ No newline at end of file diff --git a/commands/godot_build_web.sh b/commands/godot_build_web.sh new file mode 100644 index 0000000..9ee753b --- /dev/null +++ b/commands/godot_build_web.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash + +NAME="$1" +PRESET="$2" +PROJECT_PATH="$3" + +OUTPUT_PATH="$(pwd)/${NAME}" + +mkdir -p "OUTPUT_PATH" +godot --headless --export-debug "${PRESET}" "${OUTPUT_PATH}/index" "${PROJECT_PATH}/project.godot" \ No newline at end of file diff --git a/commands/godot_project_title.sh b/commands/godot_project_title.sh new file mode 100755 index 0000000..a58b327 --- /dev/null +++ b/commands/godot_project_title.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +PROJECT_PATH="$1" +PROJECT_NAME=$(sed -nE 's/^config\/name="(.*)"/\1/p' < ${PROJECT_PATH}/project.godot) +echo "$PROJECT_NAME" \ No newline at end of file -- GitLab