Actualización del documento de requisitos para incluir el nuevo módul… #2
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: Deploy Documentation to GitHub Pages | ||
|
Check failure on line 1 in .github/workflows/docs-deploy.yml
|
||
| on: | ||
| push: | ||
| branches: | ||
| - main | ||
| - develop | ||
| pull_request: | ||
| branches: | ||
| - main | ||
| workflow_dispatch: | ||
| # Permisos para GitHub Pages | ||
| permissions: | ||
| contents: read | ||
| pages: write | ||
| id-token: write | ||
| # Evitar jobs concurrentes | ||
| concurrency: | ||
| group: "pages" | ||
| cancel-in-pending: true | ||
| jobs: | ||
| # ============================================================================= | ||
| # Job para construir la documentación | ||
| # ============================================================================= | ||
| build: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout código | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 # Necesario para git-revision-date-localized | ||
| - name: Configurar Python | ||
| uses: actions/setup-python@v4 | ||
| with: | ||
| python-version: '3.11' | ||
| - name: Cache dependencias Python | ||
| uses: actions/cache@v3 | ||
| with: | ||
| path: ~/.cache/pip | ||
| key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} | ||
| restore-keys: | | ||
| ${{ runner.os }}-pip- | ||
| - name: Instalar dependencias | ||
| run: | | ||
| python -m pip install --upgrade pip | ||
| pip install -r docs/requirements.txt | ||
| - name: Instalar Material for MkDocs | ||
| run: | | ||
| pip install mkdocs-material[imaging] | ||
| pip install mkdocs-git-revision-date-localized-plugin | ||
| pip install mkdocs-git-committers-plugin | ||
| pip install mkdocs-minify-plugin | ||
| pip install mkdocs-pdf-export-plugin | ||
| pip install mkdocs-gitbook-plugin | ||
| pip install pymdown-extensions | ||
| - name: Configurar Git | ||
| run: | | ||
| git config --global user.name "GitHub Actions" | ||
| git config --global user.email "actions@github.com" | ||
| - name: Construir documentación | ||
| run: | | ||
| cd docs | ||
| mkdocs build --verbose | ||
| - name: Verificar construcción | ||
| run: | | ||
| ls -la docs/site/ | ||
| echo "Documentación construida exitosamente" | ||
| - name: Subir artefactos | ||
| uses: actions/upload-pages-artifact@v2 | ||
| with: | ||
| path: docs/site | ||
| # ============================================================================= | ||
| # Job para desplegar a GitHub Pages | ||
| # ============================================================================= | ||
| deploy: | ||
| if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop' | ||
| environment: | ||
| name: github-pages | ||
| url: ${{ steps.deployment.outputs.page_url }} | ||
| runs-on: ubuntu-latest | ||
| needs: build | ||
| steps: | ||
| - name: Desplegar a GitHub Pages | ||
| id: deployment | ||
| uses: actions/deploy-pages@v2 | ||
| - name: Notificar despliegue | ||
| if: success() | ||
| run: | | ||
| echo "🎓 Documentación de Keiko Latam desplegada exitosamente!" | ||
| echo "📚 URL: ${{ steps.deployment.outputs.page_url }}" | ||
| # Determinar entorno | ||
| if [ "${{ github.ref }}" == "refs/heads/main" ]; then | ||
| echo "🚀 Desplegado en: PRODUCCIÓN" | ||
| elif [ "${{ github.ref }}" == "refs/heads/develop" ]; then | ||
| echo "🧪 Desplegado en: DESARROLLO" | ||
| fi | ||
| # ============================================================================= | ||
| # Job para validar documentación en PRs | ||
| # ============================================================================= | ||
| validate: | ||
| if: github.event_name == 'pull_request' | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout código | ||
| uses: actions/checkout@v4 | ||
| - name: Configurar Python | ||
| uses: actions/setup-python@v4 | ||
| with: | ||
| python-version: '3.11' | ||
| - name: Instalar dependencias | ||
| run: | | ||
| python -m pip install --upgrade pip | ||
| pip install -r docs/requirements.txt | ||
| pip install mkdocs-material[imaging] | ||
| pip install mkdocs-git-revision-date-localized-plugin | ||
| pip install mkdocs-git-committers-plugin | ||
| pip install mkdocs-minify-plugin | ||
| pip install pymdown-extensions | ||
| - name: Validar configuración MkDocs | ||
| run: | | ||
| cd docs | ||
| mkdocs config | ||
| - name: Construir documentación (solo validación) | ||
| run: | | ||
| cd docs | ||
| mkdocs build --strict | ||
| - name: Validar links rotos | ||
| run: | | ||
| pip install linkchecker | ||
| cd docs | ||
| linkchecker --check-extern site/index.html || true | ||
| - name: Comentar en PR | ||
| if: always() | ||
| uses: actions/github-script@v6 | ||
| with: | ||
| script: | | ||
| const { data: comments } = await github.rest.issues.listComments({ | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| issue_number: context.issue.number, | ||
| }); | ||
| const botComment = comments.find(comment => | ||
| comment.user.type === 'Bot' && | ||
| comment.body.includes('📚 Validación de documentación') | ||
| ); | ||
| const body = `## 📚 Validación de documentación | ||
| ### ✅ Resultado | ||
| ${{ job.status === 'success' ? '✅ **PASÓ** - La documentación se construyó exitosamente' : '❌ **FALLÓ** - Hay errores en la documentación' }} | ||
| ### 📋 Detalles | ||
| - **Branch**: \`${{ github.head_ref || github.ref_name }}\` | ||
| - **Commit**: \`${{ github.sha }}\` | ||
| - **Workflow**: [${{ github.workflow }}](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) | ||
| ### 🔍 Verificación | ||
| - ✅ Configuración MkDocs válida | ||
| - ✅ Construcción exitosa | ||
| - ✅ Sin errores de sintaxis | ||
| ${{ job.status === 'success' ? '🎉 La documentación está lista para ser desplegada!' : '⚠️ Por favor, revisa los errores antes de hacer merge.' }}`; | ||
| if (botComment) { | ||
| await github.rest.issues.updateComment({ | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| comment_id: botComment.id, | ||
| body: body | ||
| }); | ||
| } else { | ||
| await github.rest.issues.createComment({ | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| issue_number: context.issue.number, | ||
| body: body | ||
| }); | ||
| } | ||
| # ============================================================================= | ||
| # Job para generar PDF de la documentación | ||
| # ============================================================================= | ||
| generate-pdf: | ||
| if: github.ref == 'refs/heads/main' | ||
| runs-on: ubuntu-latest | ||
| needs: build | ||
| steps: | ||
| - name: Checkout código | ||
| uses: actions/checkout@v4 | ||
| - name: Configurar Python | ||
| uses: actions/setup-python@v4 | ||
| with: | ||
| python-version: '3.11' | ||
| - name: Instalar dependencias | ||
| run: | | ||
| python -m pip install --upgrade pip | ||
| pip install -r docs/requirements.txt | ||
| pip install mkdocs-material[imaging] | ||
| pip install mkdocs-pdf-export-plugin | ||
| - name: Generar PDF | ||
| run: | | ||
| cd docs | ||
| ENABLE_PDF_EXPORT=1 mkdocs build | ||
| - name: Subir PDF como release asset | ||
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | ||
| uses: actions/upload-release-asset@v1 | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| with: | ||
| upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
| asset_path: docs/site/keiko-documentation.pdf | ||
| asset_name: keiko-documentation.pdf | ||
| asset_content_type: application/pdf | ||