3 # builds a Godot project with all its native export config options
4 ################################################################################
7 [[ -z "$URI_PROJECT_SNAPSHOT" ]] && echo No URI_PROJECT_SNAPSHOT, exiting && exit 1
9 echo Getting project - $URI_PROJECT_SNAPSHOT
12 DIR_PROJECT_ROOT=/project
14 wget $URI_PROJECT_SNAPSHOT && \
15 tar -xf *.tar.gz -C $DIR_PROJECT_ROOT && \
18 DIR_PROJECT=$(find $DIR_PROJECT_ROOT -type f -name project.godot | sed 's|/project.godot||')
20 echo Project directory - $DIR_PROJECT
22 ################################################################################
23 # execute project build
25 DIR_DEBUG=$DIR_BUILD/debug
26 DIR_RELEASE=$DIR_BUILD/release
29 GODOT_OPTS="--headless --path $DIR_PROJECT"
30 EXPORT_PRESETS_CFG="$DIR_PROJECT/export_presets.cfg"
32 echo Godot version - $($GODOT --headless --version)
34 # iterate through all build types present in config file
35 # if arg is given, override automated export discovery
40 EXPORT_NAMES=$(awk -F= '$1=="name"{print $2}' $EXPORT_PRESETS_CFG | sed 's/"//g')
43 for EXPORT_NAME in $EXPORT_NAMES
46 echo Starting project build for export $EXPORT_NAME
48 # create build folders
49 [[ -d $DIR_RELEASE/$EXPORT_NAME ]] || mkdir -p $DIR_RELEASE/$EXPORT_NAME
50 [[ -d $DIR_DEBUG/$EXPORT_NAME ]] || mkdir -p $DIR_DEBUG/$EXPORT_NAME
52 # get export name from config file
53 EXPORT_FNAME=$(awk -vname=${EXPORT_NAME} -F= \
54 '$1=="name" && $2~name{f=1} f==1 && $1=="export_path"{print $2;exit}' \
55 $EXPORT_PRESETS_CFG | sed -e 's|^.*/||' -e 's/"//g')
58 echo $GODOT $GODOT_OPTS --export-debug "$EXPORT_NAME" $DIR_DEBUG/$EXPORT_NAME/$EXPORT_FNAME
59 $GODOT $GODOT_OPTS --export-debug "$EXPORT_NAME" $DIR_DEBUG/$EXPORT_NAME/$EXPORT_FNAME
60 echo $GODOT $GODOT_OPTS --export-release "$EXPORT_NAME" $DIR_RELEASE/$EXPORT_NAME/$EXPORT_FNAME
61 $GODOT $GODOT_OPTS --export-release "$EXPORT_NAME" $DIR_RELEASE/$EXPORT_NAME/$EXPORT_FNAME