Pulls from godot repo not godot-builds repo
This commit is contained in:
+9
-8
@@ -35,16 +35,15 @@ function Get-Checksum([string]$ManifestPath, [string]$Asset) {
|
||||
$_ -match '^([0-9A-Fa-f]{128})\s+\*?(.+)$' -and $Matches[2] -eq $Asset
|
||||
} | Select-Object -First 1
|
||||
if (-not $line) {
|
||||
Fail "Release checksum manifest does not contain $Asset."
|
||||
Fail "Godot $GodotVersion does not publish required $edition asset '$Asset' for Windows/$HostArch at $script:BaseUrl. Choose a supported stable release and architecture."
|
||||
}
|
||||
return ($line -split '\s+')[0].ToLowerInvariant()
|
||||
}
|
||||
|
||||
function Download-AndVerify([string]$Asset, [string]$Destination, [string]$ManifestPath) {
|
||||
function Download-AndVerify([string]$Asset, [string]$Destination, [string]$ExpectedChecksum) {
|
||||
Invoke-WebRequest -Uri "$script:BaseUrl/$Asset" -OutFile $Destination
|
||||
$expected = Get-Checksum $ManifestPath $Asset
|
||||
$actual = (Get-FileHash -LiteralPath $Destination -Algorithm SHA512).Hash.ToLowerInvariant()
|
||||
if ($actual -ne $expected) {
|
||||
if ($actual -ne $ExpectedChecksum) {
|
||||
Fail "SHA-512 verification failed for $Asset."
|
||||
}
|
||||
}
|
||||
@@ -69,7 +68,7 @@ $ActionRoot = Require-Environment 'GODOT_ACTION_ROOT'
|
||||
$Workspace = Require-Environment 'GITHUB_WORKSPACE'
|
||||
$GithubOutput = Require-Environment 'GITHUB_OUTPUT'
|
||||
|
||||
if ($GodotVersion -notmatch '^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.' }
|
||||
if ($GodotVersion -notmatch '^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.' }
|
||||
if ($HostOs -ne 'windows') { Fail "host-os must be 'windows' when this action runs on Windows." }
|
||||
if ($Dotnet -notin @('true', 'false')) { Fail "dotnet must be 'true' or 'false'." }
|
||||
if ($ExportMode -notin @('release', 'debug')) { Fail "export-mode must be 'release' or 'debug'." }
|
||||
@@ -106,7 +105,7 @@ if ($Dotnet -eq 'true') {
|
||||
$templatesAsset = "Godot_v${GodotVersion}_export_templates.tpz"
|
||||
}
|
||||
|
||||
$script:BaseUrl = "https://github.com/godotengine/godot-builds/releases/download/$GodotVersion"
|
||||
$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'
|
||||
@@ -126,8 +125,10 @@ if (-not $editorExecutable) {
|
||||
$editorArchive = Join-Path $cacheDirectory $editorAsset
|
||||
$templatesArchive = Join-Path $cacheDirectory $templatesAsset
|
||||
Invoke-WebRequest -Uri "$script:BaseUrl/SHA512-SUMS.txt" -OutFile $manifestPath
|
||||
Download-AndVerify $editorAsset $editorArchive $manifestPath
|
||||
Download-AndVerify $templatesAsset $templatesArchive $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
|
||||
$editorExecutable = Find-Editor $editorDirectory
|
||||
|
||||
Reference in New Issue
Block a user