+#!/bin/bash
+
+# gets a Godot release, fetches export templates,
+# and builds a project with its native export options
+
+PWD=`pwd`
+DIR_DOWNLOAD=$PWD/download
+DIR_TEMPLATES=$DIR_DOWNLOAD/templates
+DIR_DEBUG=$PWD/debug
+DIR_RELEASE=$PWD/release
+DIR_PROJECT=$PWD/project
+
+GODOT_VERSION=4.4-stable
+GODOT_ZIP=Godot_v${GODOT_VERSION}_linux.x86_64.zip
+GODOT_EXE=Godot_v${GODOT_VERSION}_linux.x86_64
+GODOT_URI=https://github.com/godotengine/godot/releases/download/$GODOT_VERSION/$GODOT_ZIP
+
+GODOT_EXPORT_TEMPLATES=Godot_v${GODOT_VERSION}_export_templates.tpz
+GODOT_TEMPLATE_URI=https://github.com/godotengine/godot/releases/download/$GODOT_VERSION/$GODOT_EXPORT_TEMPLATES
+
+GODOT=$DIR_DOWNLOAD/$GODOT_EXE
+
+# get Godot
+[[ -d $DIR_DOWNLOAD ]] || mkpath -p $DIR_DOWNLOAD
+[[ -f $DIR_DOWNLOAD/$GODOT_ZIP ]] || wget -P $DIR_DOWNLOAD $GODOT_URI
+[[ -f $DIR_DOWNLOAD/$GODOT_EXE ]] || unzip $DIR_DOWNLOAD/$GODOT_ZIP -d $DIR_DOWNLOAD
+
+echo Godot version - $($GODOT --headless --version)
+
+# get export templates
+[[ -f $DIR_DOWNLOAD/$GODOT_EXPORT_TEMPLATES ]] || wget -P $DIR_DOWNLOAD $GODOT_TEMPLATE_URI
+[[ -d $DIR_TEMPLATES ]] || unzip -d $DIR_DOWNLOAD $DIR_DOWNLOAD/$GODOT_EXPORT_TEMPLATES
+
+GODOT_TEMPLATE_VERSION=$(cat $DIR_TEMPLATES/version.txt)
+LOCAL_TEMPLATES=$HOME/.local/share/godot/export_templates/$GODOT_TEMPLATE_VERSION
+if [[ ! -d $LOCAL_TEMPLATES ]]
+then
+ mkdir -p $LOCAL_TEMPLATES
+ cp $DIR_TEMPLATES/* $LOCAL_TEMPLATES
+ # TODO: leaves extra stuff
+fi
+
+echo Godot export template version - $GODOT_TEMPLATE_VERSION
+echo Local templates - $LOCAL_TEMPLATES
+
+# execute project build
+PLATFORM=macOS
+[[ -d $DIR_RELEASE/$PLATFORM ]] || mkdir -p $DIR_RELEASE/$PLATFORM
+[[ -d $DIR_DEBUG/$PLATFORM ]] || mkdir -p $DIR_DEBUG/$PLATFORM
+
+echo Starting project build
+$GODOT --headless --export-debug --path $DIR_PROJECT $PLATFORM $DIR_DEBUG/$PLATFORM/wolf-seeking-sheep.dmg