Files
3x-ui/.github/workflows/docs-deploy.yml
T
MHSanaei b11ceac18e fix(ci): install the docs-pinned pnpm instead of floating on 11.x
pnpm/action-setup resolved 'version: 11' to the newest 11.x, and its self-installer crashes upgrading to 11.12.0 (Cannot use 'in' operator to search for 'integrity'), failing both docs workflows at setup. Reading docs/package.json instead installs the exact packageManager pin (pnpm@11.9.0), which also keeps the workflows and the lockfile toolchain on a single source of truth.
2026-07-14 03:50:16 +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:
package_json_file: docs/package.json
- 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