Some checks failed
Deploy Documentation Local / deploy-docs (push) Has been cancelled
221 lines
7.4 KiB
YAML
221 lines
7.4 KiB
YAML
name: Deploy Documentation Local
|
|
run-name: Deploying ${{ gitea.repository }} docs locally
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
paths:
|
|
- "docs/**"
|
|
|
|
jobs:
|
|
deploy-docs:
|
|
runs-on: windows:host # Ejecutar directamente en el host Windows
|
|
steps:
|
|
- name: Check out repository code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Python for MkDocs
|
|
uses: actions/setup-python@v4
|
|
with:
|
|
python-version: "3.x"
|
|
|
|
- name: Install MkDocs and dependencies
|
|
run: |
|
|
pip install mkdocs mkdocs-material
|
|
|
|
- name: Build documentation
|
|
run: |
|
|
cd docs
|
|
mkdocs build --site-dir ../build
|
|
|
|
- name: Deploy to IIS directory
|
|
shell: powershell
|
|
run: |
|
|
$projectName = "${{ gitea.repository_name }}"
|
|
$basePath = "${{ secrets.DEPLOY_BASE_PATH }}"
|
|
$targetPath = Join-Path $basePath $projectName
|
|
|
|
# Crear directorio del proyecto si no existe
|
|
if (Test-Path $targetPath) {
|
|
Remove-Item -Path $targetPath -Recurse -Force
|
|
}
|
|
New-Item -ItemType Directory -Path $targetPath -Force
|
|
|
|
# Copiar archivos construidos
|
|
Copy-Item -Path "build\*" -Destination $targetPath -Recurse -Force
|
|
|
|
Write-Host "Documentation deployed to: $targetPath"
|
|
|
|
- name: Generate main index.html
|
|
shell: powershell
|
|
run: |
|
|
$docsPath = "${{ secrets.DEPLOY_BASE_PATH }}"
|
|
$indexPath = Join-Path $docsPath "index.html"
|
|
|
|
# Obtener todos los directorios de documentación
|
|
$docFolders = Get-ChildItem -Path $docsPath -Directory | Where-Object { $_.Name -notin @("dev", "test") } | Sort-Object Name
|
|
|
|
# Generar HTML del índice
|
|
$htmlContent = @"
|
|
<!DOCTYPE html>
|
|
<html lang="es">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Documentación - MCV Ingenieros</title>
|
|
<style>
|
|
* {
|
|
margin: 0;
|
|
padding: 0;
|
|
box-sizing: border-box;
|
|
}
|
|
|
|
body {
|
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
|
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
|
min-height: 100vh;
|
|
padding: 20px;
|
|
}
|
|
|
|
.container {
|
|
max-width: 1200px;
|
|
margin: 0 auto;
|
|
}
|
|
|
|
.header {
|
|
text-align: center;
|
|
color: white;
|
|
margin-bottom: 40px;
|
|
padding: 40px 20px;
|
|
}
|
|
|
|
.header h1 {
|
|
font-size: 3rem;
|
|
font-weight: 300;
|
|
margin-bottom: 10px;
|
|
}
|
|
|
|
.header p {
|
|
font-size: 1.2rem;
|
|
opacity: 0.9;
|
|
}
|
|
|
|
.projects {
|
|
display: grid;
|
|
gap: 25px;
|
|
grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
|
|
}
|
|
|
|
.project-card {
|
|
background: white;
|
|
border-radius: 15px;
|
|
padding: 30px;
|
|
box-shadow: 0 10px 30px rgba(0,0,0,0.1);
|
|
transition: all 0.3s ease;
|
|
position: relative;
|
|
overflow: hidden;
|
|
}
|
|
|
|
.project-card::before {
|
|
content: '';
|
|
position: absolute;
|
|
top: 0;
|
|
left: 0;
|
|
right: 0;
|
|
height: 4px;
|
|
background: linear-gradient(90deg, #667eea, #764ba2);
|
|
}
|
|
|
|
.project-card:hover {
|
|
transform: translateY(-10px);
|
|
box-shadow: 0 20px 40px rgba(0,0,0,0.15);
|
|
}
|
|
|
|
.project-link {
|
|
text-decoration: none;
|
|
color: #333;
|
|
display: block;
|
|
}
|
|
|
|
.project-icon {
|
|
font-size: 48px;
|
|
margin-bottom: 20px;
|
|
display: block;
|
|
}
|
|
|
|
.project-title {
|
|
font-size: 24px;
|
|
font-weight: 600;
|
|
margin-bottom: 15px;
|
|
color: #2c3e50;
|
|
}
|
|
|
|
.project-meta {
|
|
color: #7f8c8d;
|
|
font-size: 14px;
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 5px;
|
|
}
|
|
|
|
.footer {
|
|
text-align: center;
|
|
margin-top: 60px;
|
|
color: white;
|
|
opacity: 0.8;
|
|
font-size: 14px;
|
|
}
|
|
|
|
@media (max-width: 768px) {
|
|
.header h1 { font-size: 2rem; }
|
|
.projects { grid-template-columns: 1fr; }
|
|
.project-card { padding: 20px; }
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="container">
|
|
<div class="header">
|
|
<h1>📚 Centro de Documentación</h1>
|
|
<p>MCV Ingenieros - Documentación de Proyectos</p>
|
|
</div>
|
|
|
|
<div class="projects">
|
|
"@
|
|
|
|
foreach ($folder in $docFolders) {
|
|
$folderName = $folder.Name
|
|
$lastWrite = $folder.LastWriteTime.ToString("dd/MM/yyyy HH:mm")
|
|
|
|
$htmlContent += @"
|
|
<div class="project-card">
|
|
<a href="./$folderName/" class="project-link">
|
|
<span class="project-icon">📖</span>
|
|
<h3 class="project-title">$folderName</h3>
|
|
<div class="project-meta">
|
|
<span>🕒</span>
|
|
<span>Actualizado: $lastWrite</span>
|
|
</div>
|
|
</a>
|
|
</div>
|
|
"@
|
|
}
|
|
|
|
$currentDate = (Get-Date).ToString("dd/MM/yyyy HH:mm")
|
|
$htmlContent += @"
|
|
</div>
|
|
|
|
<div class="footer">
|
|
<p>Índice generado automáticamente el $currentDate</p>
|
|
<p>Powered by Gitea Actions & IIS</p>
|
|
</div>
|
|
</div>
|
|
</body>
|
|
</html>
|
|
"@
|
|
|
|
# Escribir el archivo index.html
|
|
Set-Content -Path $indexPath -Value $htmlContent -Encoding UTF8
|
|
Write-Host "Index.html actualizado en: $indexPath"
|