Skip to content

Instantly share code, notes, and snippets.

@martinpi
Last active February 19, 2026 09:03
Show Gist options
  • Select an option

  • Save martinpi/06fef4c6b3514fd6def60075dabfd235 to your computer and use it in GitHub Desktop.

Select an option

Save martinpi/06fef4c6b3514fd6def60075dabfd235 to your computer and use it in GitHub Desktop.
A build script for exporting a Godot game for 3 platforms, notarising with Apple & uploading to Steam. Needs a lot of setup, so can't be used as-is but might serve as inspiration!
#!/bin/bash
# Made for Godot on MacOS but should be easily adaptible to Linux and maybe even PowerShell
# from: https://stackoverflow.com/questions/192249/how-do-i-parse-command-line-arguments-in-bash
POSITIONAL_ARGS=()
while [[ $# -gt 0 ]]; do
case $1 in
-b|--build)
BUILDNUMBER="$2"
shift # past argument
shift # past value
;;
-t|--type)
BUILDTYPE="$2"
shift # past argument
shift # past value
;;
-l|--login)
LOGIN="$2"
shift # past argument
shift # past value
;;
-i|--appid)
APPID="$2"
shift # past argument
shift # past value
;;
-*|--*)
echo "Unknown option $1"
exit 1
;;
*)
POSITIONAL_ARGS+=("$1") # save positional arg
shift # past argument
;;
esac
done
set -- "${POSITIONAL_ARGS[@]}" # restore positional parameters
echo "BUILDNUMBER = ${BUILDNUMBER}"
echo "BUILDTYPE = ${BUILDTYPE}"
if [[ -z "${BUILDTYPE}" ]] ; then
echo "Please specify build type (playtest/demo/release) [${BUILDTYPE}]"
exit 0
fi
set -o errexit
echo "BUILDING"
echo "===> Building Linux"
godot --headless --export-release "linux-steam-${BUILDTYPE}" ../../../sparrowwarfare/project.godot> ./last-build-linux.txt || { echo "Command failed"; exit 1; }
echo "===> Building Windows"
godot --headless --export-release "win-steam-${BUILDTYPE}" ../../../sparrowwarfare/project.godot > ./last-build-win.txt || { echo "Command failed"; exit 1; }
echo "===> Building MacOS"
godot --headless --export-release "mac-steam-${BUILDTYPE}" ../../../sparrowwarfare/project.godot > ./last-build-mac.txt || { echo "Command failed"; exit 1; }
UUID=`cat ./last-build-mac.txt | sed -n -e 's/^Notarization: Notarization request UUID: \"\(.*\)\"/\1/p'`
echo "UNPACKING"
hdiutil attach -nobrowse -quiet ../../macOS/SparrowWarfare.dmg || { echo "Command failed"; exit 1; }
cp -r /Volumes/SparrowWarfare/* ../../macOS
hdiutil detach -force -quiet /Volumes/SparrowWarfare
echo "ARCHIVING"
mv ../../macOS/SparrowWarfare.dmg ../../archive/SparrowWarfare-mac-${BUILDTYPE}-${BUILDNUMBER}.dmg
cd ../../Windows
/usr/bin/zip -rq ../archive/SparrowWarfare-win-${BUILDTYPE}-${BUILDNUMBER}.zip .
cd ../Linux
/usr/bin/zip -rq ../archive/SparrowWarfare-linux-${BUILDTYPE}-${BUILDNUMBER}.zip .
cd ../content-builder-1.62/builder_osx
echo "BUILD RESULT: $BUILDTYPE ok, UUID $UUID"
echo "===> Wait for notarisation"
sh wait.sh -u ${UUID}
echo "STEAM UPLOAD"
# get password from keychain
PASSWORD=`security find-generic-password -s "build-system" -a "$LOGIN" -w`
if [[ -z ${LOGIN} ]]; then
echo "Please specify a LOGIN [${LOGIN}]"
exit 0
fi
if [[ -z ${PASSWORD} ]]; then
echo "Please specify a PASSWORD [${PASSWORD}]"
exit 0
fi
if [[ -z ${APPID} ]]; then
echo "Please specify an APPID [${APPID}]"
exit 0
fi
echo "LOGIN = ${LOGIN}"
echo "APPID = ${APPID}"
read -p "Press enter to upload $BUILDTYPE to App ID $APPID"
sh steamcmd.sh +login ${LOGIN} ${PASSWORD} +run_app_build ../scripts/app_build_${APPID}.vdf +quit
echo "DONE ($BUILDTYPE => $APPID)"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment