@@ -159,15 +159,53 @@ jobs:
159159 fi
160160 echo "::endgroup::"
161161
162- - name : ⬇️ Checkout repository (for scripts)
162+ - name : ⬇️ Checkout repository (for scripts and landing site )
163163 uses : actions/checkout@v6
164164 with :
165+ ref : dev
165166 path : ./repo-scripts
166167 sparse-checkout : |
167168 ${{ vars.BOOK_TOOLS }}/scripts/publish/modify_dev_announcement.py
168- .github/dev-landing/index.html
169+ .github/dev-landing/book-index.html
170+ book/quarto/landing_site
171+ book/quarto/assets/styles
169172 sparse-checkout-cone-mode : false
170173
174+ - name : 🔧 Install Quarto
175+ uses : quarto-dev/quarto-actions/setup@v2
176+
177+ - name : 🏠 Build and prepare landing site
178+ run : |
179+ echo "🏗️ Rendering Quarto landing site..."
180+ cd ./repo-scripts/book/quarto
181+ quarto render landing_site/index.qmd
182+ echo "✅ Landing site rendered"
183+ ls -la _build/html-landing/
184+
185+ echo "🔧 Rewriting URLs for dev site..."
186+ # The landing page hardcodes mlsysbook.ai URLs — rewrite for dev site structure.
187+ # The rendered index.html will be served from the ROOT of the dev site, so
188+ # relative paths use no ../ prefix (e.g. book/vol1/, tinytorch/).
189+ cd _build/html-landing
190+ for f in $(find . -name "*.html" -type f); do
191+ # Volume links: mlsysbook.ai/vol1/ -> book/vol1/
192+ sed -i 's|https://mlsysbook.ai/vol1/|book/vol1/|g' "$f"
193+ sed -i 's|https://mlsysbook.ai/vol2/|book/vol2/|g' "$f"
194+ # Other subsite links
195+ sed -i 's|https://mlsysbook.ai/tinytorch/|tinytorch/|g' "$f"
196+ sed -i 's|https://mlsysbook.ai/kits/|kits/|g' "$f"
197+ sed -i 's|https://mlsysbook.ai/labs/|labs/|g' "$f"
198+ # Navbar relative links (href="vol1/" etc. produced by Quarto from _quarto.yml)
199+ sed -i 's|href="vol1/"|href="book/vol1/"|g' "$f"
200+ sed -i 's|href="vol2/"|href="book/vol2/"|g' "$f"
201+ # Download links
202+ sed -i 's|https://mlsysbook.ai/vol1/assets/downloads/|book/vol1/assets/downloads/|g' "$f"
203+ sed -i 's|https://mlsysbook.ai/vol2/assets/downloads/|book/vol2/assets/downloads/|g' "$f"
204+ # Remaining mlsysbook.ai base URL (e.g. site-url, og tags) -> dev site root
205+ sed -i 's|https://mlsysbook.ai/|./|g' "$f"
206+ done
207+ echo "✅ URL rewriting complete"
208+
171209 - name : 🔧 Modify announcement for dev preview
172210 run : |
173211 echo "🔧 Modifying announcement banner for development preview..."
@@ -213,9 +251,17 @@ jobs:
213251 echo "🚚 Copying book content to /${{ vars.DEV_BOOK_PATH }}/ subdirectory..."
214252 cp -r "${{ github.workspace }}/preview-site/." ${{ vars.DEV_BOOK_PATH }}/
215253
216- echo "📄 Deploying landing page to root..."
217- # Copy landing page (preserves tinytorch/ if it exists)
218- cp "${{ github.workspace }}/repo-scripts/.github/dev-landing/index.html" index.html
254+ echo "📄 Deploying Quarto landing site to root..."
255+ # Copy rendered landing site to root (preserves tinytorch/ and book/ if they exist)
256+ LANDING_DIR="${{ github.workspace }}/repo-scripts/book/quarto/_build/html-landing"
257+ if [ -d "$LANDING_DIR" ]; then
258+ cp -r "$LANDING_DIR"/. ./
259+ echo "✅ Quarto landing site deployed to root"
260+ else
261+ echo "⚠️ Landing site not found, falling back to book-index.html"
262+ fi
263+ # Copy book volume chooser page so /book/ doesn't 404
264+ cp "${{ github.workspace }}/repo-scripts/.github/dev-landing/book-index.html" ${{ vars.DEV_BOOK_PATH }}/index.html
219265 touch .nojekyll
220266
221267 echo "🔍 Validating deployment content..."
0 commit comments