Skip to content

docs: update README.MD #15

docs: update README.MD

docs: update README.MD #15

Workflow file for this run

name: Build and Deploy Documentation
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
permissions:
contents: write
jobs:
build-doc:
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
- name: Copy and rename hardware images for documentation
run: |
mkdir -p software/documentation/images
# Buscar y copiar dimension
file=$(ls hardware/resources/unit_dimension_*.png 2>/dev/null | head -n1)
if [ -n "$file" ]; then cp "$file" software/documentation/images/dimension.png; else echo "dimension not found"; fi
# Buscar y copiar pinout
file=$(ls hardware/resources/unit_pinout_*.png 2>/dev/null | head -n1)
if [ -n "$file" ]; then cp "$file" software/documentation/images/pinout.png; else echo "pinout not found"; fi
# Buscar y copiar top
file=$(ls hardware/resources/unit_top_*.png 2>/dev/null | head -n1)
if [ -n "$file" ]; then cp "$file" software/documentation/images/top.png; else echo "top not found"; fi
#################################################
# 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
#################################################
# Generar Documentación Sphinx (HTML + PDF)
#################################################
- name: Build Sphinx Documentation
working-directory: software/sphinx
run: |
make clean
make pdfx
#################################################
# Preparar contenido para docs/
#################################################
- name: Prepare docs/ directory
env:
REPO_NAME: ${{ github.event.repository.name }}
run: |
rm -rf docs
mkdir -p docs
# PDF generado desde LaTeX
cp software/documentation/build/${REPO_NAME}_product_brief.pdf docs/
# PDF generado por Sphinx
pdf_file=$(ls software/sphinx/pdf/*.pdf 2>/dev/null | head -n1)
if [ -n "$pdf_file" ]; then
cp "$pdf_file" docs/${REPO_NAME}_sphinx.pdf
else
echo "No PDF found in software/sphinx/pdf/"
fi
# HTML generado por Sphinx
cp -r software/sphinx/docs/* docs/
# Permitir archivos especiales en GitHub Pages
touch docs/.nojekyll
#################################################
# Publicar cambios a la rama 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 "actions@github.com"
git pull origin main
git add docs/
git commit -m "Deploy full documentation and product brief [skip ci]" || echo "No changes"
git push origin main