]> Untitled Git - godot-builder.git/commitdiff
Initial version 0.1.0
authorClifton Palmer <clifton.james.palmer@protonmail.com>
Wed, 12 Mar 2025 17:48:11 +0000 (12:48 -0500)
committerClifton Palmer <clifton.james.palmer@protonmail.com>
Wed, 12 Mar 2025 17:52:32 +0000 (12:52 -0500)
Dockerfile [new file with mode: 0644]
docker-compose.yml [new file with mode: 0644]
entrypoint.sh [new file with mode: 0755]

diff --git a/Dockerfile b/Dockerfile
new file mode 100644 (file)
index 0000000..dcc7de7
--- /dev/null
@@ -0,0 +1,5 @@
+FROM cjpalmer/godot:0.1.0
+
+ADD ./entrypoint.sh .
+
+ENTRYPOINT [ "./entrypoint.sh" ]
diff --git a/docker-compose.yml b/docker-compose.yml
new file mode 100644 (file)
index 0000000..e6a35d3
--- /dev/null
@@ -0,0 +1,19 @@
+version: '3'
+services:
+    godot-builder:
+        build: .
+        image: cjpalmer/godot-builder:0.1.0
+        volumes:
+        - godot-build:/build
+        - godot-project:/project
+        environment:
+        - URI_PROJECT_SNAPSHOT=https://git.purplebirdman.com/wolf-seeking-sheep.git/snapshot/refs/heads/big-rick.tar.gz
+volumes:
+    godot-build:
+        driver: local
+        driver_opts:
+            o: bind
+            type: none
+            device: /srv/build
+    godot-project:
+        driver: local
diff --git a/entrypoint.sh b/entrypoint.sh
new file mode 100755 (executable)
index 0000000..27c3ef5
--- /dev/null
@@ -0,0 +1,62 @@
+#!/bin/bash
+
+# builds a Godot project with all its native export config options
+################################################################################
+# get project 
+
+[[ -z "$URI_PROJECT_SNAPSHOT" ]] && echo No URI_PROJECT_SNAPSHOT, exiting && exit 1
+
+echo Getting project - $URI_PROJECT_SNAPSHOT
+
+DIR_BUILD=/build
+DIR_PROJECT_ROOT=/project
+
+wget $URI_PROJECT_SNAPSHOT && \
+    tar -xf *.tar.gz -C $DIR_PROJECT_ROOT && \
+    rm *.tar.gz
+
+DIR_PROJECT=$(find $DIR_PROJECT_ROOT -type f -name project.godot | sed 's|/project.godot||')
+
+echo Project directory - $DIR_PROJECT
+
+################################################################################
+# execute project build
+
+DIR_DEBUG=$DIR_BUILD/debug
+DIR_RELEASE=$DIR_BUILD/release
+
+GODOT="godot"
+GODOT_OPTS="--headless --path $DIR_PROJECT"
+EXPORT_PRESETS_CFG="$DIR_PROJECT/export_presets.cfg"
+
+echo Godot version - $($GODOT --headless --version)
+
+# iterate through all build types present in config file
+# if arg is given, override automated export discovery
+if [[ -n "$1" ]]
+then
+    EXPORT_NAMES=$1
+else
+    EXPORT_NAMES=$(awk -F= '$1=="name"{print $2}' $EXPORT_PRESETS_CFG | sed 's/"//g')
+fi
+
+for EXPORT_NAME in $EXPORT_NAMES
+do
+    echo
+    echo Starting project build for export $EXPORT_NAME
+
+    # create build folders
+    [[ -d $DIR_RELEASE/$EXPORT_NAME ]] || mkdir -p $DIR_RELEASE/$EXPORT_NAME
+    [[ -d $DIR_DEBUG/$EXPORT_NAME ]] || mkdir -p $DIR_DEBUG/$EXPORT_NAME
+
+    # get export name from config file
+    EXPORT_FNAME=$(awk -vname=${EXPORT_NAME} -F= \
+        '$1=="name" && $2~name{f=1} f==1 && $1=="export_path"{print $2;exit}' \
+        $EXPORT_PRESETS_CFG | sed -e 's|^.*/||' -e 's/"//g')
+
+    # do build!
+    echo $GODOT $GODOT_OPTS --export-debug "$EXPORT_NAME" $DIR_DEBUG/$EXPORT_NAME/$EXPORT_FNAME
+    $GODOT $GODOT_OPTS --export-debug "$EXPORT_NAME" $DIR_DEBUG/$EXPORT_NAME/$EXPORT_FNAME
+    echo $GODOT $GODOT_OPTS --export-release "$EXPORT_NAME" $DIR_RELEASE/$EXPORT_NAME/$EXPORT_FNAME
+    $GODOT $GODOT_OPTS --export-release "$EXPORT_NAME" $DIR_RELEASE/$EXPORT_NAME/$EXPORT_FNAME
+done