Update check: version feed from the git server's releases, title-screen banner, clearer version refusals

This commit is contained in:
Paul Bailey
2026-11-05 16:56:11 +00:00
parent a8eaf0d12e
commit 6ab72f2c05
11 changed files with 446 additions and 4 deletions

View File

@@ -15,7 +15,14 @@
cd "$(dirname "$0")/.." || exit 1
. tools/godot_env.sh
VERSION=$(sed -n 's/^application\/short_version="\(.*\)"/\1/p' export_presets.cfg | head -1)
VERSION=$(sed -n 's/^config\/version="\(.*\)"/\1/p' project.godot | head -1)
PROTOCOL=$(sed -n 's/^const PROTOCOL := \([0-9]*\).*/\1/p' scripts/net/net.gd | head -1)
# The packages' own version numbers must say the same as the game's.
for v in $(grep -E '^application/(short_version|version|file_version|product_version)=' export_presets.cfg | sed 's/.*="\(.*\)"/\1/'); do
if [ "$v" != "$VERSION" ]; then
echo "export_presets.cfg says $v but project.godot's config/version is $VERSION: make them match"; exit 1
fi
done
which=${1:-all}
mkdir -p build
"$GODOT" --headless --path . --import >/dev/null 2>&1
@@ -41,3 +48,20 @@ if [ "$which" = all ] || [ "$which" = Windows ]; then
echo "Windows export failed: see build/export-windows.log"; exit 1
fi
fi
# build/version.json, for the release (scripts/core/updates.gd reads it):
# upload it with the zips. NOTES="..." tools/export.sh adds a line of notes.
python3 - "$VERSION" "$PROTOCOL" "${NOTES:-}" <<'EOF'
import hashlib, json, os, sys, datetime
version, protocol, notes = sys.argv[1], int(sys.argv[2]), sys.argv[3]
out = {"version": version, "protocol": protocol, "date": datetime.date.today().isoformat(), "downloads": {}}
if notes:
out["notes"] = notes
for plat in ("macos", "windows"):
f = "build/Emberwild-%s-%s.zip" % (version, plat)
if os.path.exists(f):
h = hashlib.sha256(open(f, "rb").read()).hexdigest()
out["downloads"][plat] = {"file": os.path.basename(f), "sha256": h, "size": os.path.getsize(f)}
json.dump(out, open("build/version.json", "w"), indent="\t")
print("wrote build/version.json (%s, protocol %d: %s)" % (version, protocol, ", ".join(out["downloads"]) or "no packages"))
EOF