docs: add automated compose documentation generation pipeline
This commit is contained in:
Executable
+31
@@ -0,0 +1,31 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
# Discover compose files for docs tooling and CI without running containers.
|
||||
ROOT="$(git rev-parse --show-toplevel 2>/dev/null || pwd)"
|
||||
cd "$ROOT"
|
||||
|
||||
declare -a files=()
|
||||
|
||||
if [ -f services-up.sh ]; then
|
||||
# Parse literal FILES array entries (e.g., default-network.yml) and reuse
|
||||
# compose search roots inferred from services-up.sh.
|
||||
while IFS= read -r line; do
|
||||
path=$(sed -E 's#.*\$PROJECT_ROOT/([^" ]+).*#\1#' <<<"$line")
|
||||
[ -f "$path" ] && files+=("$path")
|
||||
done < <(awk '/^FILES=\(/,/^\)/ {print}' services-up.sh | rg '\-f\s+"\$PROJECT_ROOT/')
|
||||
|
||||
if rg -q 'find "\$PROJECT_ROOT/apps" "\$PROJECT_ROOT/monitoring" "\$PROJECT_ROOT/core"' services-up.sh; then
|
||||
while IFS= read -r f; do files+=("$f"); done < <(
|
||||
find apps monitoring core -maxdepth 2 -type f \( -name 'docker-compose.yml' -o -name 'docker-compose.yaml' -o -name 'compose.yml' -o -name 'compose.yaml' \) | sed 's#^\./##' | sort
|
||||
)
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "${#files[@]}" -eq 0 ]; then
|
||||
while IFS= read -r f; do files+=("$f"); done < <(
|
||||
find . -type f \( -name 'docker-compose.yml' -o -name 'docker-compose.yaml' -o -name 'compose.yml' -o -name 'compose.yaml' \) | sed 's#^\./##' | sort
|
||||
)
|
||||
fi
|
||||
|
||||
printf '%s\n' "${files[@]}" | awk 'NF' | awk '!seen[$0]++'
|
||||
Reference in New Issue
Block a user