name: Documentation Build

on:
  push:
    branches: [ main, claude/** ]
    paths:
      - 'codex-docs/**'
      - '.github/workflows/docs-build.yml'
  pull_request:
    branches: [ main ]
    paths:
      - 'codex-docs/**'

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v3

    - name: Set up Python
      uses: actions/setup-python@v4
      with:
        python-version: '3.11'

    - name: Install MkDocs and dependencies
      run: |
        python -m pip install --upgrade pip
        pip install mkdocs mkdocs-material mkdocstrings pymdown-extensions

    - name: Build documentation
      run: |
        cd codex-docs
        mkdocs build --strict

    - name: Upload docs artifact
      uses: actions/upload-artifact@v3
      with:
        name: documentation
        path: codex-docs/site/
