From 2e3e05940e33eb9a965cbdf91097adbe1a66ed52 Mon Sep 17 00:00:00 2001 From: Manuel Date: Mon, 1 Sep 2025 01:24:20 +0200 Subject: [PATCH] gitea dev runner --- .gitea/workflows/deploy-docs-dev.yaml | 221 ++++++++++++++++++++++++++ .gitea/workflows/deploy-docs.yaml | 2 +- 2 files changed, 222 insertions(+), 1 deletion(-) create mode 100644 .gitea/workflows/deploy-docs-dev.yaml diff --git a/.gitea/workflows/deploy-docs-dev.yaml b/.gitea/workflows/deploy-docs-dev.yaml new file mode 100644 index 0000000..a2e9c19 --- /dev/null +++ b/.gitea/workflows/deploy-docs-dev.yaml @@ -0,0 +1,221 @@ +name: Deploy Documentation Local +run-name: Deploying ${{ gitea.repository }} docs locally + +on: + push: + branches: + - dev + 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 "dev" $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" diff --git a/.gitea/workflows/deploy-docs.yaml b/.gitea/workflows/deploy-docs.yaml index 71d3096..0c6ac54 100644 --- a/.gitea/workflows/deploy-docs.yaml +++ b/.gitea/workflows/deploy-docs.yaml @@ -54,7 +54,7 @@ jobs: $indexPath = Join-Path $docsPath "index.html" # Obtener todos los directorios de documentaci贸n - $docFolders = Get-ChildItem -Path $docsPath -Directory | Sort-Object Name + $docFolders = Get-ChildItem -Path $docsPath -Directory | Where-Object { $_.Name -notin @("dev", "test") } | Sort-Object Name # Generar HTML del 铆ndice $htmlContent = @"