Pulls from godot repo not godot-builds repo
This commit is contained in:
+19
-8
@@ -16,7 +16,7 @@ require_environment() {
|
||||
}
|
||||
|
||||
validate_common_inputs() {
|
||||
[[ "$GODOT_VERSION" =~ ^4(\.[0-9]+){1,2}(-[0-9A-Za-z][0-9A-Za-z._-]*)?$ ]] || fail "godot-version must be a Godot 4 release tag such as 4.7.2-stable."
|
||||
[[ "$GODOT_VERSION" =~ ^4(\.[0-9]+){1,2}-stable$ ]] || fail "godot-version must be a stable Godot 4 tag such as 4.7.2-stable. Alpha, beta, RC, and dev tags are not supported."
|
||||
[[ "$GODOT_HOST_OS" == "linux" ]] || fail "host-os must be 'linux' when this action runs on Linux."
|
||||
[[ "$GODOT_DOTNET" == "true" || "$GODOT_DOTNET" == "false" ]] || fail "dotnet must be 'true' or 'false'."
|
||||
[[ "$GODOT_EXPORT_MODE" == "release" || "$GODOT_EXPORT_MODE" == "debug" ]] || fail "export-mode must be 'release' or 'debug'."
|
||||
@@ -35,16 +35,23 @@ actual_architecture() {
|
||||
esac
|
||||
}
|
||||
|
||||
release_asset_checksum() {
|
||||
local asset="$1"
|
||||
local sum_file="$2"
|
||||
local expected
|
||||
|
||||
expected="$(awk -v asset="$asset" '$2 == asset || $2 == "*" asset { print $1; exit }' "$sum_file")"
|
||||
[[ -n "$expected" ]] || fail "Godot $GODOT_VERSION does not publish required $EDITION asset '$asset' for Linux/$GODOT_HOST_ARCH at $BASE_URL. Choose a supported stable release and architecture."
|
||||
printf '%s\n' "$expected"
|
||||
}
|
||||
|
||||
download_and_verify() {
|
||||
local asset="$1"
|
||||
local destination="$2"
|
||||
local sum_file="$3"
|
||||
local expected
|
||||
local expected="$3"
|
||||
local actual
|
||||
|
||||
curl --fail --location --retry 3 --silent --show-error "$BASE_URL/$asset" --output "$destination"
|
||||
expected="$(awk -v asset="$asset" '$2 == asset || $2 == "*" asset { print $1; exit }' "$sum_file")"
|
||||
[[ -n "$expected" ]] || fail "Release checksum manifest does not contain $asset."
|
||||
actual="$(sha512sum "$destination" | awk '{ print $1 }')"
|
||||
[[ "$actual" == "$expected" ]] || fail "SHA-512 verification failed for $asset."
|
||||
}
|
||||
@@ -57,12 +64,16 @@ 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 editor_checksum
|
||||
local templates_checksum
|
||||
|
||||
rm -rf "$CACHE_DIR"
|
||||
mkdir -p "$EDITOR_DIR" "$TEMPLATE_DIR"
|
||||
curl --fail --location --retry 3 --silent --show-error "$BASE_URL/SHA512-SUMS.txt" --output "$sum_file"
|
||||
download_and_verify "$EDITOR_ASSET" "$editor_archive" "$sum_file"
|
||||
download_and_verify "$TEMPLATES_ASSET" "$templates_archive" "$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"
|
||||
EDITOR_EXECUTABLE="$(find_editor)"
|
||||
@@ -113,7 +124,7 @@ else
|
||||
TEMPLATES_ASSET="Godot_v${GODOT_VERSION}_export_templates.tpz"
|
||||
fi
|
||||
|
||||
BASE_URL="https://github.com/godotengine/godot-builds/releases/download/$GODOT_VERSION"
|
||||
BASE_URL="https://github.com/godotengine/godot/releases/download/$GODOT_VERSION"
|
||||
TEMPLATE_VERSION="${GODOT_VERSION//-/.}"
|
||||
CACHE_DIR="$GODOT_ACTION_ROOT/cache/$GODOT_VERSION/$EDITION/linux-$GODOT_HOST_ARCH"
|
||||
EDITOR_DIR="$CACHE_DIR/editor"
|
||||
|
||||
Reference in New Issue
Block a user