|
| 1 | +# AWS Amplify Hosting build spec for the Bloqade Astro/Starlight docs site. |
| 2 | +# |
| 3 | +# WHY THIS LIVES AT THE REPO ROOT (not website/): the site build is NOT |
| 4 | +# self-contained under website/. It runs `uv sync` against the root pyproject, |
| 5 | +# reads docs/digital/** for the tutorial emitter, and clones the API source |
| 6 | +# tags with the root-installed `bloqade-*` packages. So Amplify must build from |
| 7 | +# the repo root — do NOT configure a monorepo `appRoot` in the console; leave |
| 8 | +# the app root at "/" so this file is used verbatim. Artifacts are then pointed |
| 9 | +# at website/dist below. |
| 10 | +# |
| 11 | +# This mirrors the generate->build half of .github/workflows/website-deploy.yml. |
| 12 | +# It deliberately OMITS the CI gates (vitest, link/xref checks, Playwright |
| 13 | +# runtime crawl) — those stay in GitHub Actions on PRs. Amplify only needs to |
| 14 | +# produce the servable dist/. |
| 15 | +# |
| 16 | +# Because Amplify serves both production and PR previews at a domain ROOT (never |
| 17 | +# a gh-pages subpath), SITE_BASE is "/" here — all the gh-pages `/next/` and |
| 18 | +# `/astro-preview/pr-N/` base juggling simply disappears. |
| 19 | +version: 1 |
| 20 | +env: |
| 21 | + variables: |
| 22 | + # Pins mirror the GitHub Actions workflow so builds are reproducible. |
| 23 | + NODE_VERSION: "24" |
| 24 | + PNPM_VERSION: "11" |
| 25 | + UV_VERSION: "0.5.1" |
| 26 | + RUST_TOOLCHAIN: "nightly-2026-04-17" # rustdoc JSON format_version 57 |
| 27 | + # Served at the domain root on Amplify — no subpath. Override SITE_URL |
| 28 | + # per-branch in the Amplify console if you want correct canonical/sitemap |
| 29 | + # URLs on the production branch (e.g. https://bloqade.quera.com). |
| 30 | + SITE_BASE: "/" |
| 31 | + SITE_URL: "https://bloqade.quera.com" |
| 32 | + # WIP-parity: warn (don't fail the deploy) on unresolved <ApiXref>. Flip to |
| 33 | + # "1" once the API content is stable if you want strict previews. |
| 34 | + XREF_STRICT: "0" |
| 35 | + EXECUTE_NOTEBOOKS: "1" # execute tutorials (cache-first; failures degrade to static) |
| 36 | +frontend: |
| 37 | + phases: |
| 38 | + preBuild: |
| 39 | + commands: |
| 40 | + # --- Node 24 + pnpm 11 (corepack ships with Node 24) -------------- |
| 41 | + - nvm install "$NODE_VERSION" |
| 42 | + - nvm use "$NODE_VERSION" |
| 43 | + - corepack enable |
| 44 | + - corepack prepare "pnpm@$PNPM_VERSION" --activate |
| 45 | + # --- uv (Python) — installs to ~/.local/bin -------------------------- |
| 46 | + - curl -LsSf "https://astral.sh/uv/${UV_VERSION}/install.sh" | sh |
| 47 | + - export PATH="$HOME/.local/bin:$PATH" |
| 48 | + # Install bloqade into the root env so resolve_sources.py can pin each |
| 49 | + # API source tag via `uv pip show bloqade-*`. |
| 50 | + - uv sync |
| 51 | + # --- Rust nightly for rustdoc JSON ---------------------------------- |
| 52 | + - curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal --default-toolchain none |
| 53 | + - export PATH="$HOME/.cargo/bin:$PATH" |
| 54 | + - rustup toolchain install "$RUST_TOOLCHAIN" --profile minimal |
| 55 | + # --- website JS deps ------------------------------------------------ |
| 56 | + - pnpm --dir website install --frozen-lockfile |
| 57 | + build: |
| 58 | + commands: |
| 59 | + # Re-establish PATH for the build phase (Amplify may start a fresh shell |
| 60 | + # per phase; harmless if it persists). |
| 61 | + - export PATH="$HOME/.local/bin:$HOME/.cargo/bin:$PATH" |
| 62 | + - nvm use "$NODE_VERSION" |
| 63 | + # Generate src/content/docs/api/dev/** (python + rust) + inventories + |
| 64 | + # versions.json. |
| 65 | + - > |
| 66 | + uv run python website/scripts/build_versions.py |
| 67 | + --versions dev |
| 68 | + --clone-dir website/sources |
| 69 | + --rust-toolchain "$RUST_TOOLCHAIN" |
| 70 | + # Generate guides/tutorials/** from docs/digital/** (cache-first: a warm |
| 71 | + # .notebook-cache => zero kernel executions). |
| 72 | + - uv run --project website/emitters/notebooks bloqade-docs-build-notebooks |
| 73 | + # Build the static site -> website/dist. |
| 74 | + - pnpm --dir website build |
| 75 | + artifacts: |
| 76 | + baseDirectory: website/dist |
| 77 | + files: |
| 78 | + - "**/*" |
| 79 | + cache: |
| 80 | + paths: |
| 81 | + # JS + Astro incremental content |
| 82 | + - website/node_modules/**/* |
| 83 | + - website/.astro/**/* |
| 84 | + # Content-addressed executed-notebook cache (the emitter fingerprints each |
| 85 | + # notebook internally; caching the dir gives the warm-cache fast path). |
| 86 | + - website/emitters/notebooks/.notebook-cache/**/* |
| 87 | + # Python / uv |
| 88 | + - .venv/**/* |
| 89 | + - website/emitters/notebooks/.venv/**/* |
| 90 | + - $HOME/.cache/uv/**/* |
| 91 | + # Rust toolchain + compiled crate cache (large; avoids re-download/rebuild) |
| 92 | + - $HOME/.rustup/**/* |
| 93 | + - $HOME/.cargo/registry/**/* |
| 94 | + - $HOME/.cargo/git/**/* |
0 commit comments