diff --git a/README.md b/README.md index f6e2f2d..69199b9 100644 --- a/README.md +++ b/README.md @@ -48,7 +48,7 @@ The uploaded artifact is the whole build folder, so companion files such as a `. | Input | Required | Default | Description | | --- | --- | --- | --- | -| `godot-version` | Yes | — | The Godot 4 release tag to use, without the leading `v`; for example, `4.7.2-stable`. | +| `godot-version` | Yes | — | A stable Godot 4 release tag, without the leading `v`; for example, `4.7.2-stable`. Alpha, beta, RC, and dev tags are unsupported. | | `host-os` | Yes | — | The machine running the job: `linux`, `macos`, or `windows`. The action checks this before it starts. | | `host-arch` | Yes | — | The runner's architecture. Linux supports `x86_32`, `x86_64`, `arm32`, and `arm64`; Windows supports `x86_32`, `x86_64`, and `arm64`; macOS supports `x86_64` and `arm64`. | | `export-preset` | Yes | — | The preset name exactly as it appears in `export_presets.cfg`. | @@ -67,7 +67,8 @@ The uploaded artifact is the whole build folder, so companion files such as a `. ## A few helpful notes - Your project needs both `project.godot` and `export_presets.cfg`. Preset names with spaces, such as `Windows Desktop`, are fine. -- Downloads are checked against Godot's published `SHA512-SUMS.txt` file before anything is extracted. +- Editor and template downloads come from the [official Godot stable-release assets](https://github.com/godotengine/godot/releases) and are checked against that release's `SHA512-SUMS.txt` before anything is extracted. If a release does not provide an editor for the requested runner architecture, the action fails before downloading either archive. +- Linux ARM downloads require Godot 4.2 or newer; Windows ARM64 downloads require Godot 4.3 or newer. macOS uses the universal editor archive on both supported architectures. - On Linux, make sure the runner has `curl`, `unzip`, and `sha512sum`. macOS needs `curl`, `unzip`, and `shasum`. Windows uses the archive and hashing tools built into PowerShell. - The cache includes the editor and the full export-template package. Gitea keeps that cache on each runner by default; an administrator can configure shared storage if several runners should reuse it. - This action installs Godot, not every SDK around it. Android, iOS, console, and other platform-specific presets may still need their own SDKs, credentials, or signing setup on the runner. diff --git a/action.yml b/action.yml index babdfd3..0a55538 100644 --- a/action.yml +++ b/action.yml @@ -3,7 +3,7 @@ description: Download and cache Godot 4, install export templates, and export a inputs: godot-version: - description: Exact Godot 4 release tag without a leading v (for example, 4.6.1-stable). + description: Exact stable Godot 4 release tag without a leading v (for example, 4.6.1-stable). Prerelease tags are unsupported. required: true host-os: description: "Runner operating system: linux, macos, or windows." diff --git a/export-linux.sh b/export-linux.sh index 9214930..8162db3 100644 --- a/export-linux.sh +++ b/export-linux.sh @@ -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" diff --git a/export-macos.sh b/export-macos.sh index 8e549f4..9dbce41 100644 --- a/export-macos.sh +++ b/export-macos.sh @@ -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" == "macos" ]] || fail "host-os must be 'macos' when this action runs on macOS." [[ "$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'." @@ -33,16 +33,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 macOS/$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="$(shasum -a 512 "$destination" | awk '{ print $1 }')" [[ "$actual" == "$expected" ]] || fail "SHA-512 verification failed for $asset." } @@ -55,12 +62,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)" @@ -111,7 +122,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/macos-$GODOT_HOST_ARCH" EDITOR_DIR="$CACHE_DIR/editor" diff --git a/export-windows.ps1 b/export-windows.ps1 index 6ae13f5..fcd5f8b 100644 --- a/export-windows.ps1 +++ b/export-windows.ps1 @@ -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