feat: Update-Prüfung beim Start und Versions-Endpunkt
- App prüft version.json beim Start (nur exportierte Desktop-Builds) - Dialog, Download mit SHA-256-Prüfung, Installation je Plattform - manueller Menüpunkt, übersprungene Version in user://update.cfg - Endpunkt unter rinkplanner.programmschmiede.de/version.json - tools/publish_version.sh und Doku in docs/updates.md - Version 0.2.0
This commit is contained in:
parent
b75953e97f
commit
54e1c5dc34
23 changed files with 1378 additions and 12 deletions
|
|
@ -43,7 +43,7 @@ VERSION="$(
|
|||
sed -n 's/^[[:space:]]*application\/product_version="\([^"]*\)"/\1/p' \
|
||||
"$PROJECT_DIR/export_presets.cfg" | head -1
|
||||
)"
|
||||
VERSION="${VERSION:-0.1.0.0}"
|
||||
VERSION="${VERSION:-0.2.0.0}"
|
||||
if [[ "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
|
||||
VERSION="$VERSION.0"
|
||||
fi
|
||||
|
|
|
|||
178
tools/publish_version.sh
Executable file
178
tools/publish_version.sh
Executable file
|
|
@ -0,0 +1,178 @@
|
|||
#!/usr/bin/env bash
|
||||
# Veröffentlicht den Update-Endpunkt für die App.
|
||||
#
|
||||
# Erzeugt build/version.json aus der Version in rinkplanner/project.godot und
|
||||
# den vorhandenen Installern und lädt ihn nach
|
||||
# https://rinkplanner.programmschmiede.de/version.json
|
||||
#
|
||||
# Aufruf:
|
||||
# ./tools/publish_version.sh # macOS-DMG veröffentlichen
|
||||
# ./tools/publish_version.sh --windows # zusätzlich den Windows-Installer
|
||||
# ./tools/publish_version.sh --no-upload # nur build/version.json schreiben
|
||||
# ./tools/publish_version.sh --check # live-Endpunkt anzeigen
|
||||
# ./tools/publish_version.sh --notes "Text" # Neuerungen im Dialog
|
||||
#
|
||||
# Beim Windows-Installer wird die Version nicht geprüft: erst bauen, dann mit
|
||||
# --windows veröffentlichen.
|
||||
set -euo pipefail
|
||||
|
||||
source "$(dirname "${BASH_SOURCE[0]}")/_export_common.sh"
|
||||
|
||||
MACOS="$REPO_ROOT/build/macos/rinkplanner-setup.dmg"
|
||||
WINDOWS_EXE="$REPO_ROOT/build/windows/rinkplanner-setup.exe"
|
||||
OUT="$REPO_ROOT/build/version.json"
|
||||
ENDPOINT_URL="https://rinkplanner.programmschmiede.de/version.json"
|
||||
FTP_TARGET_DIR="rinkplanner.programmschmiede.de"
|
||||
NOTES=""
|
||||
NO_UPLOAD=0
|
||||
CHECK=0
|
||||
WITH_WINDOWS=0
|
||||
|
||||
usage() {
|
||||
cat <<'EOF'
|
||||
Aufruf: tools/publish_version.sh [--windows] [--notes TEXT]
|
||||
[--no-upload] [--check]
|
||||
|
||||
--windows Windows-Installer (build/windows/rinkplanner-setup.exe)
|
||||
mit aufnehmen. Vorher neu bauen.
|
||||
--notes Neuerungen für den Update-Dialog.
|
||||
--no-upload Nur build/version.json schreiben, nicht hochladen.
|
||||
--check Den live veröffentlichten Endpunkt anzeigen.
|
||||
EOF
|
||||
}
|
||||
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case "$1" in
|
||||
--windows)
|
||||
WITH_WINDOWS=1
|
||||
shift
|
||||
;;
|
||||
--notes)
|
||||
NOTES="${2:-}"
|
||||
if [[ -z "$NOTES" ]]; then
|
||||
echo "--notes braucht einen Text." >&2
|
||||
exit 1
|
||||
fi
|
||||
shift 2
|
||||
;;
|
||||
--no-upload)
|
||||
NO_UPLOAD=1
|
||||
shift
|
||||
;;
|
||||
--check)
|
||||
CHECK=1
|
||||
shift
|
||||
;;
|
||||
-h|--help)
|
||||
usage
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
echo "Unbekannte Option: $1" >&2
|
||||
usage >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [[ "$CHECK" -eq 1 ]]; then
|
||||
curl -fsSL -H "Cache-Control: no-cache" "$ENDPOINT_URL"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
VERSION="$(
|
||||
sed -n 's/^config\/version="\([^"]*\)"/\1/p' "$PROJECT_DIR/project.godot" |
|
||||
head -1
|
||||
)"
|
||||
if [[ -z "$VERSION" ]]; then
|
||||
echo "Version fehlt in rinkplanner/project.godot (config/version)." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
MACOS_ARG=""
|
||||
if [[ -f "$MACOS" ]]; then
|
||||
MACOS_ARG="$MACOS"
|
||||
fi
|
||||
WINDOWS_ARG=""
|
||||
if [[ "$WITH_WINDOWS" -eq 1 ]]; then
|
||||
if [[ ! -f "$WINDOWS_EXE" ]]; then
|
||||
echo "Windows-Installer fehlt: $WINDOWS_EXE" >&2
|
||||
echo "Zuerst ./tools/export_windows_installer.sh ausführen." >&2
|
||||
exit 1
|
||||
fi
|
||||
WINDOWS_ARG="$WINDOWS_EXE"
|
||||
fi
|
||||
|
||||
if [[ -z "$MACOS_ARG" && -z "$WINDOWS_ARG" ]]; then
|
||||
echo "Kein Installer gefunden. Zuerst bauen:" >&2
|
||||
echo " ./tools/export_macos_installer.sh" >&2
|
||||
echo " ./tools/export_windows_installer.sh" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
mkdir -p "$(dirname "$OUT")"
|
||||
python3 - "$VERSION" "$NOTES" "$MACOS_ARG" "$WINDOWS_ARG" "$(date +%F)" <<'PY' > "$OUT"
|
||||
import hashlib
|
||||
import json
|
||||
import os
|
||||
import sys
|
||||
|
||||
version, notes, macos, windows, released = sys.argv[1:6]
|
||||
base_url = "https://programmschmiede.de/rinkplanner/download/"
|
||||
|
||||
|
||||
def entry(path):
|
||||
digest = hashlib.sha256()
|
||||
with open(path, "rb") as handle:
|
||||
for chunk in iter(lambda: handle.read(1024 * 1024), b""):
|
||||
digest.update(chunk)
|
||||
return {
|
||||
"url": base_url + os.path.basename(path),
|
||||
"sha256": digest.hexdigest(),
|
||||
"size": os.path.getsize(path),
|
||||
}
|
||||
|
||||
|
||||
data = {"version": version, "released": released, "downloads": {}}
|
||||
if notes.strip():
|
||||
data["notes"] = notes.strip()
|
||||
if macos:
|
||||
data["downloads"]["macos"] = entry(macos)
|
||||
if windows:
|
||||
data["downloads"]["windows"] = entry(windows)
|
||||
json.dump(data, sys.stdout, indent=2, ensure_ascii=False)
|
||||
print()
|
||||
PY
|
||||
|
||||
echo "Version: $VERSION"
|
||||
cat "$OUT"
|
||||
|
||||
if [[ "$NO_UPLOAD" -eq 1 ]]; then
|
||||
echo "Nicht hochgeladen (--no-upload). Datei: $OUT"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
CREDENTIALS="$REPO_ROOT/docs/credentials.txt"
|
||||
if [[ ! -f "$CREDENTIALS" ]]; then
|
||||
echo "Zugangsdaten fehlen: $CREDENTIALS" >&2
|
||||
exit 1
|
||||
fi
|
||||
set -a
|
||||
# shellcheck disable=SC1090
|
||||
source "$CREDENTIALS"
|
||||
set +a
|
||||
|
||||
curl -sS --ftp-pasv --user "$FTP_USER:$FTP_PASSWORD" \
|
||||
-T "$OUT" "ftp://$FTP_URL/$FTP_TARGET_DIR/version.json" \
|
||||
-w "upload: %{http_code} %{size_upload} bytes\n"
|
||||
|
||||
REMOTE_TMP="$(mktemp "${TMPDIR:-/tmp}/rinkplanner-version.XXXXXX")"
|
||||
trap 'rm -f "$REMOTE_TMP"' EXIT
|
||||
curl -fsSL -H "Cache-Control: no-cache" "$ENDPOINT_URL" > "$REMOTE_TMP"
|
||||
if ! cmp -s "$OUT" "$REMOTE_TMP"; then
|
||||
echo "Hinweis: Der live ausgelieferte Endpunkt weicht noch ab (Cache?)." >&2
|
||||
echo "Bitte gleich erneut mit --check prüfen." >&2
|
||||
exit 2
|
||||
fi
|
||||
|
||||
echo "Endpunkt: $ENDPOINT_URL"
|
||||
|
|
@ -78,6 +78,9 @@ fi
|
|||
"$GODOT" --headless --path "$PROJECT_DIR" \
|
||||
--script res://tests/run_hub_tests.gd
|
||||
|
||||
"$GODOT" --headless --path "$PROJECT_DIR" \
|
||||
--script res://tests/run_update_tests.gd
|
||||
|
||||
"$GODOT" --headless --path "$PROJECT_DIR" \
|
||||
--script res://tests/run_asset_manifest_tests.gd
|
||||
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
; Rinkplanner Windows-Installer (per-user, ohne Administratorrechte).
|
||||
;
|
||||
; Aufruf über tools/export_windows_installer.sh. Erwartet:
|
||||
; -DAPP_VERSION=0.1.0.0
|
||||
; -DAPP_VERSION=0.2.0.0
|
||||
; -DSOURCE_EXE=/pfad/zu/rinkplanner.exe
|
||||
; -DOUT_FILE=/pfad/zu/rinkplanner-setup.exe
|
||||
; -DICON_FILE=/pfad/zu/rinkplanner.ico
|
||||
|
||||
!ifndef APP_VERSION
|
||||
!define APP_VERSION "0.1.0.0"
|
||||
!define APP_VERSION "0.2.0.0"
|
||||
!endif
|
||||
!ifndef SOURCE_EXE
|
||||
!error "SOURCE_EXE fehlt (Pfad zur rinkplanner.exe)."
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue