Artifact 22be5f512ca0b3d3d00c9ff741c50358519f82e2b0a9b9b2db43f57704e96622:
- Executable file
scripts/sync-version.sh
— part of check-in
[d7fd910ffc]
at
2026-10-23 21:12:43
on branch main
— docs: generate the site's data, CLI reference and llms.txt from the code
tools/docsgen/engine records one check-in as an artifact, as its derived rows and as the cards of a pull, from a real engine run with fixed inputs. tools/docsgen/conformance turns TestCoverage's report into per-draft and per-requirement data. scripts/gen-cli-docs.sh writes one page per command group from the libfossil binary's --help. gen-llms-txt.sh and check-llms-txt.sh are ported from dagnats, and sync-version.sh now takes the highest release tag and writes the go.mod version too.
scripts/check-docs-generated.sh regenerates everything into a scratch dir and fails on any difference; make docs-check and the test-docs CI job run it. (user: [email protected], size: 1880) [annotate] [blame] [check-ins using] [more...]
#!/usr/bin/env bash # Writes the latest release tag into docs/site/hugo.yaml's params.version and # the go directive of go.mod into params.goVersion, so the site shows both # without a hand edit. Run by the Cloudflare build before Hugo invokes; safe # to run locally too — it only edits the working tree, never commits. # # Leaves params.version untouched if no release tag can be found. set -euo pipefail HUGO_YAML="${HUGO_YAML:-docs/site/hugo.yaml}" # Cloudflare Workers Builds does a shallow clone with no tags, so # 'git describe' finds nothing: no tag is reachable from a single commit. # Take the highest release tag by version instead, from local tags if any, # else from the remote's tag list (the repo is public). latest_tag() { git tag -l 'v*' | sort -V | tail -n 1 } remote_latest_tag() { git ls-remote --tags --refs "$1" 'v*' 2>/dev/null \ | sed 's#.*refs/tags/##' | sort -V | tail -n 1 } TAG=$(latest_tag) if [ -z "${TAG}" ]; then TAG=$(remote_latest_tag origin) fi if [ -z "${TAG}" ]; then TAG=$(remote_latest_tag https://github.com/danmestas/go-libfossil.git) fi VERSION="${TAG#v}" GO_VERSION=$(awk '$1 == "go" { print $2; exit }' go.mod) [ -n "${GO_VERSION}" ] || { echo "sync-version: no go directive in go.mod" >&2; exit 1; } # Replace the two lines. awk + temp file stays portable across GNU sed # (Linux/CF) and BSD sed (macOS). awk -v v="${VERSION}" -v g="${GO_VERSION}" ' /^ version: "/ && v != "" { print " version: \"" v "\""; next } /^ goVersion: "/ { print " goVersion: \"" g "\""; next } { print } ' "${HUGO_YAML}" > "${HUGO_YAML}.tmp" mv "${HUGO_YAML}.tmp" "${HUGO_YAML}" if [ -z "${VERSION}" ]; then echo "sync-version: no release tags found, params.version left as is" >&2 else echo "sync-version: params.version set to ${VERSION}" fi echo "sync-version: params.goVersion set to ${GO_VERSION}"