Godot 4 - 1 Click Export Tutorial (thx to Command Line under Windows)

I made a tutorial on how to setup a BAT file which exports all projects with just 1 click.

1 Like

Nice! I did a similar bash script for one of my games, using git for versioning

#!/bin/bash
# usage: ./export.sh [platform]

desc=$(git describe --tags)

mkdir -p Build/"$desc"

function godot_export() {
	build_dir="Build/$desc/${1//\//_}"
	mkdir -p "$build_dir"
	echo "Building $1 into $build_dir"

	## filename (index for web)
	name="hextype_mechapop"
	if [ "$1" == "web" ]; then
		name="index"
	fi

	## platform specific suffix
	suffix=".x86_64"
	if [ "$1" == "web" ]; then
		suffix=".html"
	elif [ "$1" == "win64" ]; then
		suffix=".exe"
	fi

	godot --headless --export-release "$1" "$build_dir/$name$suffix"
	echo "zipping..."
	zip "Build/${desc}/hextype mechapop-${desc}-${1//\//_}.zip" -j "$build_dir"/*


	## itch butler push
	channel="$1"
	if [ "$1" == "win64" ]; then
		channel="windows"
	fi
	# disabled
	#butler push "$build_dir/" "luckyson/hextype-mechapop:$channel"
}

if [ -z "$1" ]; then # no selection, default to just linux
	echo "targeting linux"
	godot_export "linux"
elif [ "$1" == "all" ]; then
	echo "targeting all..."
	godot_export "web"
	godot_export "win64"
	godot_export "linux"
else
	godot_export "$1"
fi