diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index e3afcf3..3ed0ae3 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -2,8 +2,8 @@ name: Deploy site to Pages # Builds the Docusaurus site and deploys it to GitHub Pages. # -# The Docs section is synced from rossoctl/rossoctl:docs/ at build time -# (npm run sync-docs). Triggers: +# The Docs section is synced from rossoctl/rossoctl:docs/, and /cortex/install.sh +# from rossoctl/cortex:scripts/install.sh, at build time (npm run sync-docs). Triggers: # - push to main (site source changed) # - repository_dispatch (docs changed upstream; sent by # rossoctl/rossoctl .github/workflows/docs-dispatch.yaml) @@ -43,7 +43,7 @@ jobs: - name: Install dependencies run: npm ci - - name: Sync docs from rossoctl/rossoctl:docs + - name: Sync docs from rossoctl/rossoctl and installer from rossoctl/cortex run: npm run sync-docs - name: Build diff --git a/.gitignore b/.gitignore index 7148526..5df584e 100644 --- a/.gitignore +++ b/.gitignore @@ -8,8 +8,10 @@ # committed here, regenerated on every build: # docs/ <- rossoctl/rossoctl:docs/ (Docs section) # contributing/index.md <- rossoctl/rossoctl:CONTRIBUTING.md (Contributing page) +# cortex/ <- rossoctl/cortex:scripts/install.sh (served at /cortex/install.sh) /docs /contributing/index.md +/cortex # --- Misc / editor --- .DS_Store diff --git a/docusaurus.config.ts b/docusaurus.config.ts index 2396e2a..f7f49ba 100644 --- a/docusaurus.config.ts +++ b/docusaurus.config.ts @@ -203,6 +203,16 @@ const config: Config = { 'https://github.com/rossoctl/ecosystem-guide/tree/main/content/', }, ], + // Copies cortex/ (synced by scripts/sync-docs.sh) to build/cortex/, so + // /cortex/install.sh is served as a real file. `static/` can't be used: + // it's committed, and this file must not be. + () => ({ + name: 'cortex-installer', + postBuild: async ({outDir}) => + fs.cpSync(path.join(__dirname, 'cortex'), path.join(outDir, 'cortex'), { + recursive: true, + }), + }), ], // Enables Mermaid diagram rendering (paired with markdown.mermaid: true). diff --git a/netlify.toml b/netlify.toml index 79d76ca..0cbebc0 100644 --- a/netlify.toml +++ b/netlify.toml @@ -1,7 +1,7 @@ # Netlify is used for PR deploy previews only. Production deploys go to GitHub # Pages via .github/workflows/deploy.yaml. The build syncs docs from -# rossoctl/rossoctl (a no-op while docs/ is absent / docs are hidden), then -# builds the Docusaurus site. Remove this file if the repo leaves Netlify. +# rossoctl/rossoctl and the installer from rossoctl/cortex, then builds the +# Docusaurus site. Remove this file if the repo leaves Netlify. [build] command = "npm run sync-docs && npm run build" publish = "build" diff --git a/scripts/sync-docs.sh b/scripts/sync-docs.sh index 0a3df3e..7060f9c 100755 --- a/scripts/sync-docs.sh +++ b/scripts/sync-docs.sh @@ -2,19 +2,23 @@ # sync-docs.sh — populate this site from the SOURCE OF TRUTH in rossoctl/rossoctl: # 1. docs/ -> the site's docs/ (rendered as the Docs section) # 2. CONTRIBUTING.md -> the site's contributing/index.md (Contributing page) +# and from rossoctl/cortex: +# 3. scripts/install.sh -> the site's cortex/install.sh (served at /cortex/install.sh) # -# Both destinations are git-ignored here and regenerated on every build (CI runs +# All destinations are git-ignored here and regenerated on every build (CI runs # this before `npm run build`; see .github/workflows/deploy.yaml). The canonical -# content lives in rossoctl/rossoctl — edit it there, not here. +# content lives in those upstream repos — edit it there, not here. # # Usage: # ./scripts/sync-docs.sh [git-ref] # clone from GitHub (default: main) # SRC_REPO=/path/to/local/rossoctl ./scripts/sync-docs.sh # use an existing local clone +# CORTEX_SRC_REPO=/path/to/local/cortex ./scripts/sync-docs.sh # likewise for cortex set -euo pipefail REF="${1:-main}" REPO_URL="https://github.com/rossoctl/rossoctl.git" # source of truth +CORTEX_REPO_URL="${CORTEX_REPO_URL:-https://github.com/rossoctl/cortex.git}" SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" SITE_DIR="$(dirname "$SCRIPT_DIR")" SUBDIR="docs" @@ -102,3 +106,17 @@ if [[ -f "$CONTRIB_SRC" ]]; then else echo "!! CONTRIBUTING.md not found at $CONTRIB_SRC (skipped Contributing page)." >&2 fi + +# --- 3. Cortex installer: copy scripts/install.sh -> cortex/install.sh ------- +# Fatal if missing: a published URL without the file would serve HTML to `sh`. +if [[ -n "${CORTEX_SRC_REPO:-}" ]]; then + CORTEX_SRC="$CORTEX_SRC_REPO" +else + CORTEX_SRC="$(mktemp -d)" + trap 'rm -rf ${TMP:+"$TMP"} "$CORTEX_SRC"' EXIT + git clone --depth 1 --filter=blob:none --sparse "$CORTEX_REPO_URL" "$CORTEX_SRC" + git -C "$CORTEX_SRC" sparse-checkout set scripts +fi +mkdir -p "$SITE_DIR/cortex" +rsync -a "$CORTEX_SRC/scripts/install.sh" "$SITE_DIR/cortex/install.sh" +echo "==> cortex/install.sh copied from ${CORTEX_SRC_REPO:-$CORTEX_REPO_URL}@$(git -C "$CORTEX_SRC" rev-parse --short HEAD)."