feat: patch system
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
#!/usr/bin/env -S godot --headless -s
|
||||
extends SceneTree
|
||||
|
||||
func _init():
|
||||
print("--- Starting Automated Patch Build ---")
|
||||
|
||||
var output_file = "patch.pck"
|
||||
var changed_files_txt = "changed_files.txt"
|
||||
|
||||
if not FileAccess.file_exists(changed_files_txt):
|
||||
print("ERROR: missing changed_files.txt. Cannot build patch.")
|
||||
quit(1)
|
||||
return
|
||||
|
||||
var pck_packer = PCKPacker.new()
|
||||
var err = pck_packer.pck_start(output_file)
|
||||
if err != OK:
|
||||
print("ERROR: Could not start PCK file: ", output_file)
|
||||
quit(1)
|
||||
return
|
||||
|
||||
var file = FileAccess.open(changed_files_txt, FileAccess.READ)
|
||||
var count = 0
|
||||
|
||||
while not file.eof_reached():
|
||||
var line = file.get_line().strip_edges()
|
||||
if line.is_empty(): continue
|
||||
|
||||
var res_path = "res://" + line
|
||||
# Include automatically compiled scripts for GDScript
|
||||
if line.ends_with(".gd"):
|
||||
var remap_path = res_path.replace(".gd", ".gdc")
|
||||
if FileAccess.file_exists(remap_path):
|
||||
pck_packer.add_file(res_path, remap_path)
|
||||
else:
|
||||
pck_packer.add_file(res_path, res_path)
|
||||
count += 1
|
||||
print("Adding (Script): ", res_path)
|
||||
elif FileAccess.file_exists(res_path):
|
||||
print("Adding to patch: ", res_path)
|
||||
pck_packer.add_file(res_path, res_path)
|
||||
count += 1
|
||||
else:
|
||||
print("Warning: Changed file not found or Is Directory, skipping: ", res_path)
|
||||
|
||||
# Always package our version/changelog list so clients see the new changelog
|
||||
var version_manifest = "res://assets/data/version.json"
|
||||
pck_packer.add_file(version_manifest, version_manifest)
|
||||
print("Adding Version Manifest: ", version_manifest)
|
||||
|
||||
pck_packer.flush(true)
|
||||
print("--- Patch Build Complete! Packed %d files into %s ---" % [count + 1, output_file])
|
||||
|
||||
quit(0)
|
||||
@@ -0,0 +1 @@
|
||||
uid://baco51hmps6s1
|
||||
@@ -1,77 +0,0 @@
|
||||
# PowerShell script to create game patches for itch.io distribution
|
||||
# Run this from the tekton-enet project root
|
||||
|
||||
param(
|
||||
[Parameter(Mandatory=$true)]
|
||||
[string]$Version,
|
||||
|
||||
[string]$GodotPath = "godot",
|
||||
[string]$OutputDir = ".\dist"
|
||||
)
|
||||
|
||||
Write-Host "=== Tekton Patch Creator ===" -ForegroundColor Cyan
|
||||
Write-Host "Creating patch for version: $Version" -ForegroundColor Yellow
|
||||
|
||||
# Create output directory
|
||||
if (-not (Test-Path $OutputDir)) {
|
||||
New-Item -ItemType Directory -Path $OutputDir | Out-Null
|
||||
}
|
||||
|
||||
$PckName = "tekton-local-$Version.pck"
|
||||
$PckPath = Join-Path $OutputDir $PckName
|
||||
|
||||
# Update version file
|
||||
Write-Host "Updating version.txt..." -ForegroundColor Green
|
||||
Set-Content -Path ".\version.txt" -Value $Version
|
||||
|
||||
# Export PCK only (no executable)
|
||||
Write-Host "Exporting PCK file..." -ForegroundColor Green
|
||||
Write-Host "Note: Run this export from the Godot editor or configure export preset first"
|
||||
|
||||
# Generate checksums
|
||||
Write-Host "Generating checksums..." -ForegroundColor Green
|
||||
|
||||
if (Test-Path $PckPath) {
|
||||
$md5 = (Get-FileHash -Path $PckPath -Algorithm MD5).Hash.ToLower()
|
||||
$sha256 = (Get-FileHash -Path $PckPath -Algorithm SHA256).Hash.ToLower()
|
||||
$size = (Get-Item $PckPath).Length
|
||||
|
||||
Write-Host "MD5: $md5" -ForegroundColor White
|
||||
Write-Host "SHA256: $sha256" -ForegroundColor White
|
||||
Write-Host "Size: $size bytes" -ForegroundColor White
|
||||
|
||||
# Generate JSON snippet for version.json
|
||||
$jsonSnippet = @"
|
||||
{
|
||||
"version": "$Version",
|
||||
"date": "$(Get-Date -Format 'yyyy-MM-dd')",
|
||||
"pck_url": "https://your-username.itch.io/tekton-local/files/$PckName",
|
||||
"pck_size": $size,
|
||||
"checksum_md5": "$md5",
|
||||
"checksum_sha256": "$sha256",
|
||||
"changelog": [
|
||||
"Add your changelog items here"
|
||||
],
|
||||
"required": false
|
||||
}
|
||||
"@
|
||||
|
||||
$snippetPath = Join-Path $OutputDir "release-$Version.json"
|
||||
Set-Content -Path $snippetPath -Value $jsonSnippet
|
||||
|
||||
Write-Host "`nRelease JSON snippet saved to: $snippetPath" -ForegroundColor Green
|
||||
Write-Host "Copy this into your version.json releases array" -ForegroundColor Yellow
|
||||
} else {
|
||||
Write-Host "PCK file not found at: $PckPath" -ForegroundColor Red
|
||||
Write-Host "Please export the PCK manually from Godot:" -ForegroundColor Yellow
|
||||
Write-Host " 1. Open project in Godot Editor" -ForegroundColor White
|
||||
Write-Host " 2. Go to Project > Export..." -ForegroundColor White
|
||||
Write-Host " 3. Configure Windows Desktop preset" -ForegroundColor White
|
||||
Write-Host " 4. Click 'Export PCK/ZIP' and save as $PckName" -ForegroundColor White
|
||||
}
|
||||
|
||||
Write-Host "`n=== Patch Creation Complete ===" -ForegroundColor Cyan
|
||||
Write-Host "Next steps:" -ForegroundColor Yellow
|
||||
Write-Host " 1. Upload $PckName to itch.io" -ForegroundColor White
|
||||
Write-Host " 2. Update version.json with the new release entry" -ForegroundColor White
|
||||
Write-Host " 3. Upload updated version.json to itch.io" -ForegroundColor White
|
||||
Reference in New Issue
Block a user