Files
3x-ui/.github/workflows/docs-deploy.yml
T
MHSanaei df3ba568d1 feat(docs): publish the component Storybook on the docs site
The docs site and the component workbench were entirely disconnected. The Pages deploy now builds the frontend Storybook and bundles it into the artifact under /storybook, so the live component reference ships with the documentation, and the navbar links to it. Story changes trigger a redeploy so the published workbench cannot go stale.
2026-07-14 03:37:55 +02:00

78 lines
2.3 KiB
YAML

name: Docs Deploy (GitHub Pages)
# Static-export deploy of docs/ to GitHub Pages. Pages must be enabled in repo
# settings (Source: GitHub Actions) and the docs.sanaei.dev custom domain
# attached to this repository. The site URL defaults to the production domain in
# docs/lib/shared.ts, so NEXT_PUBLIC_SITE_URL is optional.
on:
push:
branches: [main]
paths:
- 'docs/**'
- 'frontend/src/components/**'
- 'frontend/.storybook/**'
- 'frontend/package-lock.json'
- '.github/workflows/docs-deploy.yml'
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: pages
cancel-in-progress: true
defaults:
run:
working-directory: docs
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: pnpm/action-setup@v6
with:
version: 11
- uses: actions/setup-node@v6
with:
node-version-file: .nvmrc
cache: pnpm
cache-dependency-path: docs/pnpm-lock.yaml
- run: pnpm install --frozen-lockfile
- name: Build (static export)
env:
DEPLOY_TARGET: static
NEXT_PUBLIC_SITE_URL: ${{ vars.NEXT_PUBLIC_SITE_URL }}
run: pnpm build
- name: Mirror default locale (en) to the site root
# hideLocale makes most English links unprefixed (/, /docs/...), but the
# language switcher still targets /en/... . The export emits pages only
# under /en/, and there is no i18n middleware on a static host — so copy
# the English build to the root (data files included) while KEEPING /en/
# in place. That way both /docs/... and /en/docs/... resolve. Other
# locales stay under /fa, /ru, /zh.
run: cp -a out/en/. out/
- name: Build the component Storybook (frontend/)
working-directory: frontend
run: |
npm ci
npm run build-storybook
- name: Bundle Storybook at /storybook
run: cp -a ../frontend/storybook-static out/storybook
- uses: actions/upload-pages-artifact@v5
with:
path: docs/out
deploy:
needs: build
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- id: deployment
uses: actions/deploy-pages@v5