#! /usr/bin/env bash cd "$(git rev-parse --show-toplevel)" || exit REPO_ROOT="$(pwd)" # Only regenerate the endpoint index if the spec build succeeded, so a failed # build can't render docs/endpoint-index.md from a stale/partial v1.json. # # A full `dotnet build` MUST run before the doc-gen target: OpenApiGenerateDocumentsOnBuild # is false, so `-t:GenerateOpenApiDocuments` alone does NOT compile the project — it invokes # dotnet-getdocument against ErsatzTV.dll + ErsatzTV.deps.json, which don't exist in a clean # tree (e.g. the CI api-docs job, which only restores). Without the build the target fails with # "The specified deps.json … does not exist" (exit 129). Build first, then generate. (cd ErsatzTV && dotnet build && dotnet build -t:GenerateOpenApiDocuments) || exit cd "$REPO_ROOT" || exit python3 scripts/generate-endpoint-index.py