fix(ci): set baseURL for PR preview subdirectory deployment (#6658)

* refactor(ci): improve PR preview with products.yml and index page

- Load product prefixes from data/products.yml (single source of truth)
- Build regex pattern dynamically from loaded namespaces
- Fix CSS copying: Hugo outputs fingerprinted CSS at root level
- Generate index.html with clickable links to preview pages
- Add test for influxdb3_explorer namespace

This keeps the URL parser in sync as new products are added and
provides a better preview experience with navigable links.

* fix(ci): set baseURL for preview subdirectory deployment

Hugo generates absolute paths for fingerprinted assets based on baseURL.
When deploying to GitHub Pages subdirectory (pr-preview/pr-XXXX/), assets
were incorrectly resolving to the root instead of the preview path.

This sets --baseURL to the correct preview URL so all asset paths work.
pull/6632/head^2
Jason Stirnaman 2025-12-19 19:31:37 -05:00 committed by GitHub
parent e03e7874fc
commit 61a88db39b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 1 deletions

View File

@ -85,9 +85,12 @@ jobs:
- name: Build Hugo site
if: steps.detect.outputs.pages-to-deploy != '[]'
id: build
env:
# Set baseURL for GitHub Pages preview subdirectory
PREVIEW_BASE_URL: https://influxdata.github.io/docs-v2/pr-preview/pr-${{ github.event.number }}/
run: |
START_TIME=$(date +%s)
npx hugo --minify
npx hugo --minify --baseURL "$PREVIEW_BASE_URL"
END_TIME=$(date +%s)
DURATION=$((END_TIME - START_TIME))
echo "build-time=${DURATION}s" >> $GITHUB_OUTPUT