#!/usr/bin/env bash set -euo pipefail # Run this script from anywhere inside the Git repository. REPO_ROOT="$(git rev-parse --show-toplevel)" cd "$REPO_ROOT" OUTPUT_FILE="${1:-./data/gen/build_info.typ}" build_commit="$(git rev-parse HEAD)" # Latest tag reachable from the current branch/commit. build_version="$(git describe --tags --abbrev=0 2>/dev/null || true)" build_version="${build_version:-}" # typst query exits successfully when the query succeeds; use its # result as the boolean value. if typst query main.typ '' >/dev/null 2>&1; then build_status="true" else build_status="false" fi cat > "$OUTPUT_FILE" <