25 lines
812 B
Bash
25 lines
812 B
Bash
|
|
#!/usr/bin/env bash
|
||
|
|
# Regenerates src/game/build_info.json from the current git state.
|
||
|
|
# Invoke before an export so the About screen shows the correct commit.
|
||
|
|
# Usage: ./scripts/run/build-info.sh
|
||
|
|
|
||
|
|
set -euo pipefail
|
||
|
|
|
||
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||
|
|
REPO_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
|
||
|
|
|
||
|
|
COMMIT="$(git -C "$REPO_ROOT" rev-parse --short=12 HEAD 2>/dev/null || echo unknown)"
|
||
|
|
BUILD_DATE="$(date -u +%Y-%m-%dT%H:%M:%SZ)"
|
||
|
|
VERSION_BASE="$(awk -F'"' '/^config\/version=/ {print $2}' "$REPO_ROOT/src/game/project.godot" 2>/dev/null || echo 0.0.0)"
|
||
|
|
VERSION="${VERSION_BASE}-ea"
|
||
|
|
|
||
|
|
cat > "$REPO_ROOT/src/game/build_info.json" <<EOF
|
||
|
|
{
|
||
|
|
"version": "$VERSION",
|
||
|
|
"commit": "$COMMIT",
|
||
|
|
"build_date": "$BUILD_DATE",
|
||
|
|
"godot_rust": "0.2"
|
||
|
|
}
|
||
|
|
EOF
|
||
|
|
echo "Wrote build_info.json: $VERSION @ $COMMIT"
|