From: Clifton Palmer Date: Wed, 12 Mar 2025 17:48:11 +0000 (-0500) Subject: Initial version X-Git-Tag: 0.1.0 X-Git-Url: http://git.purplebirdman.com/godot-builder.git/commitdiff_plain/9394c4da3589b6079b6eb40d0a3d55bb1c800528?ds=sidebyside Initial version --- 9394c4da3589b6079b6eb40d0a3d55bb1c800528 diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..dcc7de7 --- /dev/null +++ b/Dockerfile @@ -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 index 0000000..e6a35d3 --- /dev/null +++ b/docker-compose.yml @@ -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 index 0000000..27c3ef5 --- /dev/null +++ b/entrypoint.sh @@ -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