1
0
foundryvtt_container/scripts/get_foundry_version.sh
Thomas Belway b7b4a173c7
Some checks failed
FoundryVTT Container Build / Build FoundryVTT Container (push) Failing after 1m37s
adding files
2026-02-13 00:03:57 -05:00

49 lines
1.3 KiB
Bash
Executable File

#!/bin/bash
#
# Get FoundryVTT version information
# Usage: get_foundry_version.sh [--version-only]
# --version-only: just print the latest stable version and exit
#
set -euo pipefail
# Fetch releases page and find latest stable
get_stable_version() {
local releases_page
releases_page=$(curl -fsSL "https://foundryvtt.com/releases/" 2>/dev/null || true)
if [[ -z "$releases_page" ]]; then
echo ""
return 1
fi
# Find stable releases - look for version in entries with "stable" tag
# The HTML has "Release X.Y" followed later by 'class="release-tag stable"'
local version
version=$(echo "$releases_page" | grep -B5 'class="release-tag stable"' | grep -oE 'Release [0-9]+\.[0-9]+' | head -1 | sed 's/Release //')
echo "$version"
}
# Handle --version-only flag
if [[ "${1:-}" == "--version-only" ]]; then
VERSION=$(get_stable_version)
if [[ -z "$VERSION" ]]; then
echo "Error: Failed to fetch version from FoundryVTT" >&2
exit 1
fi
echo "$VERSION"
exit 0
fi
# Default: show version with context
echo "Fetching latest stable FoundryVTT version..."
VERSION=$(get_stable_version)
if [[ -z "$VERSION" ]]; then
echo "Error: Could not determine latest stable version" >&2
exit 1
fi
echo "Latest stable version: $VERSION"