name: Deploy Documentation Local run-name: Deploying ${{ gitea.repository }} docs locally on: push: branches: - dev paths: - "docs/**" workflow_dispatch: branches: - dev paths: - "docs/**" jobs: deploy-docs: runs-on: windows # Ejecutar directamente en el host Windows steps: - name: Get project name shell: powershell run: | $projectName = "${{ gitea.repository_name }}" echo "Project Name: $projectName" - name: Check out repository code uses: actions/checkout@v4 - name: Setup Python for MkDocs uses: actions/setup-python@v4 with: python-version: "3.10" - name: Install MkDocs and dependencies run: | pip install mkdocs mkdocs-material - name: Build documentation run: | ls mkdocs build --site-dir ../build - name: Deploy to IIS directory shell: powershell run: | $projectName = "${{ gitea.repository_name }}" echo "Project Name: $projectName" $basePath = Join-Path "${{ secrets.DEPLOY_BASE_PATH }}" "dev" $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 }}" $docsPath = Join-Path $docsPath "dev" $indexPath = Join-Path $docsPath "index.html" # Obtener todos los directorios de documentación $docFolders = Get-ChildItem -Path $docsPath -Directory | Sort-Object Name # Generar HTML del índice $htmlContent = @" Documentación - MCV Ingenieros

📚 Centro de Documentación

MCV Ingenieros - Documentación de Proyectos

"@ foreach ($folder in $docFolders) { $folderName = $folder.Name $lastWrite = $folder.LastWriteTime.ToString("dd/MM/yyyy HH:mm") $htmlContent += @" "@ } $currentDate = (Get-Date).ToString("dd/MM/yyyy HH:mm") $htmlContent += @"
"@ # Escribir el archivo index.html Set-Content -Path $indexPath -Value $htmlContent -Encoding UTF8 Write-Host "Index.html actualizado en: $indexPath"