diff --git a/.gitea/workflows/changelog.yml b/.gitea/workflows/changelog.yml new file mode 100644 index 0000000..dd8ea52 --- /dev/null +++ b/.gitea/workflows/changelog.yml @@ -0,0 +1,41 @@ +name: Changelog de TIA Portal + +# 1. El disparador: Esto se ejecuta solo cuando subes un Tag que empieza por "v" (ej. v1.0.0) +on: + push: + tags: + - 'v*' + +jobs: + generar-release: + # 2. El motor: Le decimos que busque tu máquina Windows + runs-on: windows + + steps: + - name: Descargar el código + uses: actions/checkout@v3 + with: + fetch-depth: 0 # Necesario para descargar todo el historial y poder comparar + + - name: Extraer historial y formatear bloques + shell: powershell + run: | + # Obtenemos el tag anterior para saber desde dónde leer + $lastTag = git describe --tags --abbrev=0 HEAD^ 2>$null + if (-not $lastTag) { $rango = "HEAD" } else { $rango = "$lastTag..HEAD" } + + # Leemos el historial: %s es el Título, %b es el Cuerpo (los bloques modificados) + # Le damos formato Markdown (negrita para el título, cursiva para los bloques) + $commits = git log $rango --pretty=format:"- **%s**`n > *%b*`n" + + # Escribimos el resultado en un archivo temporal + $cabecera = "### 📋 Cambios en los bloques del PLC`n`n" + Set-Content -Path "notas_version.md" -Value ($cabecera + $commits) -Encoding UTF8 + + - name: Publicar Release en Gitea + uses: softprops/action-gh-release@v1 + with: + body_path: notas_version.md + env: + # Gitea inyecta este token automáticamente por ti para que tenga permisos + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file