Places build templates in correct location

This commit is contained in:
2026-08-28 17:02:28 -07:00
parent ffba9651c4
commit 391127c5b9
3 changed files with 66 additions and 9 deletions
+21 -3
View File
@@ -58,22 +58,39 @@ find_editor() {
find "$EDITOR_DIR" -type f -path '*.app/Contents/MacOS/*' -name 'Godot*' -print -quit
}
install_export_templates() {
local staging_directory="$1"
local staged_templates="$staging_directory/templates"
local staged_version="$staged_templates/version.txt"
local actual_template_version
[[ -f "$staged_version" ]] || fail "The export-template archive '$TEMPLATES_ASSET' did not contain templates/version.txt."
actual_template_version="$(tr -d '\r\n' < "$staged_version")"
[[ "$actual_template_version" == "$TEMPLATE_VERSION" ]] || fail "The export-template archive '$TEMPLATES_ASSET' reports template version '$actual_template_version', expected '$TEMPLATE_VERSION'."
mkdir -p "$TEMPLATE_DIR"
cp -R "$staged_templates/." "$TEMPLATE_DIR/"
rm -rf "$staging_directory"
[[ -f "$TEMPLATE_DIR/version.txt" ]] || fail "The export-template archive '$TEMPLATES_ASSET' could not be installed to '$TEMPLATE_DIR'."
}
install_godot() {
local sum_file="$CACHE_DIR/SHA512-SUMS.txt"
local editor_archive="$CACHE_DIR/$EDITOR_ASSET"
local templates_archive="$CACHE_DIR/$TEMPLATES_ASSET"
local templates_staging_directory="$CACHE_DIR/templates-staging"
local editor_checksum
local templates_checksum
rm -rf "$CACHE_DIR"
mkdir -p "$EDITOR_DIR" "$TEMPLATE_DIR"
mkdir -p "$EDITOR_DIR"
curl --fail --location --retry 3 --silent --show-error "$BASE_URL/SHA512-SUMS.txt" --output "$sum_file"
editor_checksum="$(release_asset_checksum "$EDITOR_ASSET" "$sum_file")"
templates_checksum="$(release_asset_checksum "$TEMPLATES_ASSET" "$sum_file")"
download_and_verify "$EDITOR_ASSET" "$editor_archive" "$editor_checksum"
download_and_verify "$TEMPLATES_ASSET" "$templates_archive" "$templates_checksum"
unzip -q "$editor_archive" -d "$EDITOR_DIR"
unzip -q "$templates_archive" -d "$TEMPLATE_DIR"
unzip -q "$templates_archive" -d "$templates_staging_directory"
install_export_templates "$templates_staging_directory"
EDITOR_EXECUTABLE="$(find_editor)"
[[ -n "$EDITOR_EXECUTABLE" ]] || fail "The Godot editor archive did not contain a macOS app executable."
[[ -f "$TEMPLATE_DIR/version.txt" ]] || fail "The export-template archive did not contain version.txt."
@@ -116,14 +133,15 @@ if [[ "$GODOT_DOTNET" == "true" ]]; then
EDITION=dotnet
EDITOR_ASSET="Godot_v${GODOT_VERSION}_mono_macos.universal.zip"
TEMPLATES_ASSET="Godot_v${GODOT_VERSION}_mono_export_templates.tpz"
TEMPLATE_VERSION="${GODOT_VERSION//-/.}.mono"
else
EDITION=standard
EDITOR_ASSET="Godot_v${GODOT_VERSION}_macos.universal.zip"
TEMPLATES_ASSET="Godot_v${GODOT_VERSION}_export_templates.tpz"
TEMPLATE_VERSION="${GODOT_VERSION//-/.}"
fi
BASE_URL="https://github.com/godotengine/godot/releases/download/$GODOT_VERSION"
TEMPLATE_VERSION="${GODOT_VERSION//-/.}"
CACHE_DIR="$GODOT_ACTION_ROOT/cache/$GODOT_VERSION/$EDITION/macos-$GODOT_HOST_ARCH"
EDITOR_DIR="$CACHE_DIR/editor"
USER_HOME="$CACHE_DIR/home"