docs: Force rebuild #80
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build and Deploy Documentation | |
| on: | |
| push: | |
| branches: [main] | |
| paths: | |
| - 'software/documentation/**' | |
| - 'software/sphinx/**' | |
| - 'README.md' | |
| - 'hardware/**' | |
| - '.github/workflows/build_pdf.yml' | |
| pull_request: | |
| branches: [main] | |
| paths: | |
| - 'software/documentation/**' | |
| - 'software/sphinx/**' | |
| - 'README.md' | |
| - 'hardware/**' | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| jobs: | |
| build-and-deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.10' | |
| - name: Install dependencies (Python + LaTeX + Ghostscript) | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y texlive-latex-extra texlive-fonts-recommended texlive-lang-english ghostscript latexmk | |
| pip install -r software/documentation/requirements.txt | |
| pip install -r software/sphinx/requirements.txt | |
| pip install Jinja2 | |
| ################################################# | |
| # Generar PDF del Product Brief con nombre del repo | |
| ################################################# | |
| - name: Build LaTeX PDF from README | |
| working-directory: software/documentation | |
| env: | |
| REPO_NAME: ${{ github.event.repository.name }} | |
| run: | | |
| python test_readme.py | |
| python generate_pdf.py | |
| gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/printer \ | |
| -dNOPAUSE -dQUIET -dBATCH \ | |
| -sOutputFile=build/${REPO_NAME}_product_brief.pdf build/*.pdf | |
| ################################################# | |
| # Procesar Documentación de Hardware | |
| ################################################# | |
| - name: Clean previous hardware documentation | |
| run: | | |
| chmod +x .github/workflows/scripts/clean_docs.sh | |
| .github/workflows/scripts/clean_docs.sh | |
| - name: Copy hardware files and generate HTML | |
| run: | | |
| chmod +x .github/workflows/scripts/build_docs.sh | |
| .github/workflows/scripts/build_docs.sh | |
| ################################################# | |
| # Generar Documentación Sphinx (HTML + PDF) | |
| ################################################# | |
| - name: Build Sphinx Documentation | |
| working-directory: software/sphinx | |
| run: | | |
| make clean | |
| make pdfx | |
| - name: Add hardware link to Sphinx docs | |
| run: | | |
| chmod +x .github/workflows/scripts/add_hardware_link.sh | |
| .github/workflows/scripts/add_hardware_link.sh | |
| ################################################# | |
| # Preparar contenido para docs/ | |
| ################################################# | |
| - name: Prepare docs/ directory | |
| env: | |
| REPO_NAME: ${{ github.event.repository.name }} | |
| run: | | |
| # Crear directorio docs si no existe (pero no eliminar hardware/) | |
| mkdir -p docs | |
| # PDF generado desde LaTeX | |
| cp software/documentation/build/${REPO_NAME}_product_brief.pdf docs/ | |
| # PDF generado por Sphinx | |
| cp software/sphinx/pdf/programmer.pdf docs/${REPO_NAME}_sphinx.pdf | |
| # HTML generado por Sphinx (copiar archivos, no sobrescribir hardware/) | |
| rsync -av --exclude='hardware' --exclude='hardware.html' software/sphinx/docs/ docs/ | |
| # Permitir archivos especiales en GitHub Pages | |
| touch docs/.nojekyll | |
| ################################################# | |
| # Commit and push docs/ to main | |
| ################################################# | |
| - name: Commit and push docs/ to main | |
| if: github.ref == 'refs/heads/main' | |
| run: | | |
| git config --global user.name "GitHub Actions" | |
| git config --global user.email "[email protected]" | |
| git add docs/ | |
| git diff --staged --quiet || git commit -m "docs: Deploy documentation (auto-generated) [skip ci]" | |
| git pull --rebase origin main | |
| git push origin main |