Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
391127c5b9 |
+21
-3
@@ -60,22 +60,39 @@ find_editor() {
|
||||
find "$EDITOR_DIR" -maxdepth 3 -type f -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 an executable."
|
||||
[[ -f "$TEMPLATE_DIR/version.txt" ]] || fail "The export-template archive did not contain version.txt."
|
||||
@@ -118,14 +135,15 @@ if [[ "$GODOT_DOTNET" == "true" ]]; then
|
||||
EDITION=dotnet
|
||||
EDITOR_ASSET="Godot_v${GODOT_VERSION}_mono_linux_${GODOT_HOST_ARCH}.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}_linux.${GODOT_HOST_ARCH}.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/linux-$GODOT_HOST_ARCH"
|
||||
EDITOR_DIR="$CACHE_DIR/editor"
|
||||
USER_DATA_DIR="$CACHE_DIR/user-data"
|
||||
|
||||
+21
-3
@@ -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"
|
||||
|
||||
+24
-3
@@ -56,6 +56,24 @@ function Find-Editor([string]$Directory) {
|
||||
return $null
|
||||
}
|
||||
|
||||
function Install-ExportTemplates([string]$StagingDirectory, [string]$TemplateDirectory, [string]$TemplateAsset, [string]$ExpectedVersion) {
|
||||
$stagedTemplates = Join-Path $StagingDirectory 'templates'
|
||||
$stagedVersion = Join-Path $stagedTemplates 'version.txt'
|
||||
if (-not (Test-Path -LiteralPath $stagedVersion -PathType Leaf)) {
|
||||
Fail "The export-template archive '$TemplateAsset' did not contain templates/version.txt."
|
||||
}
|
||||
$actualVersion = (Get-Content -LiteralPath $stagedVersion -Raw).Trim()
|
||||
if ($actualVersion -ne $ExpectedVersion) {
|
||||
Fail "The export-template archive '$TemplateAsset' reports template version '$actualVersion', expected '$ExpectedVersion'."
|
||||
}
|
||||
New-Item -ItemType Directory -Force -Path $TemplateDirectory | Out-Null
|
||||
Get-ChildItem -LiteralPath $stagedTemplates -Force | Copy-Item -Destination $TemplateDirectory -Recurse -Force
|
||||
Remove-Item -LiteralPath $StagingDirectory -Recurse -Force
|
||||
if (-not (Test-Path -LiteralPath (Join-Path $TemplateDirectory 'version.txt') -PathType Leaf)) {
|
||||
Fail "The export-template archive '$TemplateAsset' could not be installed to '$TemplateDirectory'."
|
||||
}
|
||||
}
|
||||
|
||||
$GodotVersion = Require-Environment 'GODOT_VERSION'
|
||||
$HostOs = Require-Environment 'GODOT_HOST_OS'
|
||||
$HostArch = Require-Environment 'GODOT_HOST_ARCH'
|
||||
@@ -95,6 +113,7 @@ if ($Dotnet -eq 'true') {
|
||||
'arm64' { "Godot_v${GodotVersion}_mono_windows_arm64.zip" }
|
||||
}
|
||||
$templatesAsset = "Godot_v${GodotVersion}_mono_export_templates.tpz"
|
||||
$templateVersion = ($GodotVersion -replace '-', '.') + '.mono'
|
||||
} else {
|
||||
$edition = 'standard'
|
||||
$editorAsset = switch ($HostArch) {
|
||||
@@ -103,10 +122,10 @@ if ($Dotnet -eq 'true') {
|
||||
'arm64' { "Godot_v${GodotVersion}_windows_arm64.exe.zip" }
|
||||
}
|
||||
$templatesAsset = "Godot_v${GodotVersion}_export_templates.tpz"
|
||||
$templateVersion = $GodotVersion -replace '-', '.'
|
||||
}
|
||||
|
||||
$script:BaseUrl = "https://github.com/godotengine/godot/releases/download/$GodotVersion"
|
||||
$templateVersion = $GodotVersion -replace '-', '.'
|
||||
$cacheDirectory = Join-Path $ActionRoot "cache\$GodotVersion\$edition\windows-$HostArch"
|
||||
$editorDirectory = Join-Path $cacheDirectory 'editor'
|
||||
$userHome = Join-Path $cacheDirectory 'home'
|
||||
@@ -120,17 +139,19 @@ if ((Test-Path -LiteralPath $marker -PathType Leaf) -and (Test-Path -LiteralPath
|
||||
|
||||
if (-not $editorExecutable) {
|
||||
if (Test-Path -LiteralPath $cacheDirectory) { Remove-Item -LiteralPath $cacheDirectory -Recurse -Force }
|
||||
New-Item -ItemType Directory -Force -Path $editorDirectory, $templateDirectory | Out-Null
|
||||
New-Item -ItemType Directory -Force -Path $editorDirectory | Out-Null
|
||||
$manifestPath = Join-Path $cacheDirectory 'SHA512-SUMS.txt'
|
||||
$editorArchive = Join-Path $cacheDirectory $editorAsset
|
||||
$templatesArchive = Join-Path $cacheDirectory $templatesAsset
|
||||
$templatesStagingDirectory = Join-Path $cacheDirectory 'templates-staging'
|
||||
Invoke-WebRequest -Uri "$script:BaseUrl/SHA512-SUMS.txt" -OutFile $manifestPath
|
||||
$editorChecksum = Get-Checksum $manifestPath $editorAsset
|
||||
$templatesChecksum = Get-Checksum $manifestPath $templatesAsset
|
||||
Download-AndVerify $editorAsset $editorArchive $editorChecksum
|
||||
Download-AndVerify $templatesAsset $templatesArchive $templatesChecksum
|
||||
Expand-Archive -LiteralPath $editorArchive -DestinationPath $editorDirectory -Force
|
||||
Expand-Archive -LiteralPath $templatesArchive -DestinationPath $templateDirectory -Force
|
||||
Expand-Archive -LiteralPath $templatesArchive -DestinationPath $templatesStagingDirectory -Force
|
||||
Install-ExportTemplates $templatesStagingDirectory $templateDirectory $templatesAsset $templateVersion
|
||||
$editorExecutable = Find-Editor $editorDirectory
|
||||
if (-not $editorExecutable) { Fail 'The Godot editor archive did not contain an executable.' }
|
||||
if (-not (Test-Path -LiteralPath (Join-Path $templateDirectory 'version.txt') -PathType Leaf)) { Fail 'The export-template archive did not contain version.txt.' }
|
||||
|
||||
Reference in New Issue
Block a user