SDLC docs package delivery script
This commit is contained in:
Executable
+32
@@ -0,0 +1,32 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
|
||||
ROOT_DIR="$(cd -- "$SCRIPT_DIR/.." && pwd)"
|
||||
TOOL_DIR="$SCRIPT_DIR/sdlc-delivery"
|
||||
SOURCE_DIR="$ROOT_DIR/sdlc"
|
||||
DELIVERY_ROOT="$ROOT_DIR/sdlc-delivery"
|
||||
STAGING_DIR="$ROOT_DIR/.sdlc-delivery.staging"
|
||||
|
||||
if [[ ! -d "$TOOL_DIR/node_modules/playwright" ]]; then
|
||||
echo "Installing the local PDF renderer..."
|
||||
npm install --prefix "$TOOL_DIR"
|
||||
npx --prefix "$TOOL_DIR" playwright install chromium
|
||||
fi
|
||||
|
||||
rm -rf "$STAGING_DIR"
|
||||
mkdir -p "$STAGING_DIR"
|
||||
|
||||
while IFS= read -r -d '' source; do
|
||||
relative="${source#"$ROOT_DIR/sdlc/"}"
|
||||
destination="$STAGING_DIR/${relative%.md}.pdf"
|
||||
echo "Rendering ${relative%.md}.pdf"
|
||||
node "$TOOL_DIR/render-sdlc.mjs" "$source" "$destination"
|
||||
done < <(find "$SOURCE_DIR" -type f -name '*.md' -print0 | sort -z)
|
||||
|
||||
echo "Verifying staged delivery package..."
|
||||
"$SCRIPT_DIR/verify-sdlc-delivery.sh" "$STAGING_DIR"
|
||||
|
||||
rm -rf "$DELIVERY_ROOT"
|
||||
mv "$STAGING_DIR" "$DELIVERY_ROOT"
|
||||
echo "Delivery and verification passed: $DELIVERY_ROOT"
|
||||
Reference in New Issue
Block a user