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 --------------------------------------------------------------------------------
10 echo Getting project - $URI_PROJECT_SNAPSHOT
13 DIR_PROJECT_ROOT=/project
15 wget $URI_PROJECT_SNAPSHOT && \
16 tar -xf *.tar.gz -C $DIR_PROJECT_ROOT && \
19 DIR_PROJECT=$(find $DIR_PROJECT_ROOT -type f -name project.godot | sed 's|/project.godot||')
20 PROJECT_ID=$(echo $DIR_PROJECT | awk -F/ '{print $NF}')
22 echo Project directory - $DIR_PROJECT
24 ################################################################################
25 # execute project build
27 DIR_DEBUG=$DIR_BUILD/$PROJECT_ID/debug
28 DIR_RELEASE=$DIR_BUILD/$PROJECT_ID/release
30 GODOT="godot --headless --path $DIR_PROJECT"
31 EXPORT_PRESETS_CFG="$DIR_PROJECT/export_presets.cfg"
33 echo --------------------------------------------------------------------------------
34 echo Godot version - $($GODOT --headless --version)
36 # iterate through all build types present in config file
37 # if arg is given, override automated export discovery
42 EXPORT_NAMES=$(awk -F= '$1=="name"{print $2}' $EXPORT_PRESETS_CFG | sed 's/"//g')
45 for EXPORT_NAME in $EXPORT_NAMES
47 echo --------------------------------------------------------------------------------
48 echo Starting project build for export $EXPORT_NAME
50 # create build folders
51 [[ -d $DIR_RELEASE/$EXPORT_NAME ]] || mkdir -p $DIR_RELEASE/$EXPORT_NAME
52 [[ -d $DIR_DEBUG/$EXPORT_NAME ]] || mkdir -p $DIR_DEBUG/$EXPORT_NAME
54 # get export name from config file
55 EXPORT_FNAME=$(awk -vname=${EXPORT_NAME} -F= \
56 '$1=="name" && $2~name{f=1} f==1 && $1=="export_path"{print $2;exit}' \
57 $EXPORT_PRESETS_CFG | sed -e 's|^.*/||' -e 's/"//g')
59 DEBUG_BUILD_PATH=$DIR_DEBUG/$EXPORT_NAME/$EXPORT_FNAME
60 RELEASE_BUILD_PATH=$DIR_RELEASE/$EXPORT_NAME/$EXPORT_FNAME
63 # do debug and release builds!
64 echo $GODOT --export-debug "$EXPORT_NAME" $DEBUG_BUILD_PATH
65 $GODOT --export-debug "$EXPORT_NAME" $DEBUG_BUILD_PATH
67 echo $GODOT --export-release "$EXPORT_NAME" $RELEASE_BUILD_PATH
68 $GODOT --export-release "$EXPORT_NAME" $RELEASE_BUILD_PATH
71 # zip debug and release builds and shasum them
72 for DIR in $DIR_DEBUG $DIR_RELEASE
74 ZIP_PATH=$DIR/$EXPORT_NAME
76 echo Zipping $ZIP_PATH
77 zip -r $EXPORT_NAME $ZIP_PATH && mv *.zip $DIR
81 echo --------------------------------------------------------------------------------
82 echo Computing shasums for zip files
84 for DIR in $DIR_DEBUG $DIR_RELEASE
86 $(cd $DIR && sha1sum *.zip >shasum.txt)
89 echo SHASUM from $DIR -
91 find $DIR -type f -name shasum.txt | xargs cat