diff --git a/.gitea/workflows/ci.yaml b/.gitea/workflows/ci.yaml index b7ed912..8f2a3dd 100644 --- a/.gitea/workflows/ci.yaml +++ b/.gitea/workflows/ci.yaml @@ -1,19 +1,23 @@ -name: Deploy HTML +name: MD a HTML y deploy Apache + on: push: branches: [main] + paths: + - '**.md' jobs: deploy: runs-on: ubuntu-latest - container: + container: image: ubuntu:22.04 volumes: - - /srv/devops/data/apache/htdocs:/output + - /srv/devops/data/apache/htdocs:/output + steps: - uses: actions/checkout@v3 - - name: Convertir y desplegar + - name: Convertir y publicar run: | chmod +x convertir.sh ./convertir.sh \ No newline at end of file diff --git a/convertir.sh b/convertir.sh index 64c41d6..080b70c 100644 --- a/convertir.sh +++ b/convertir.sh @@ -1,12 +1,28 @@ --#!/bin/sh -+#!/bin/bash -+set -euo pipefail +#!/bin/bash +set -euo pipefail -- for MD in $(ls *.md) -+ for md in *.md; do -+ [ -f "$md" ] || continue +dependencies(){ + apt-get update -qq + apt-get install -y -qq pandoc +} -- echo "USAR scp O ftp O CUALQUIER OTRA COSA PARA SUBIR LOS HTML: $HTML" -- cat $HTML -+ cp "$html" /output/ -+ echo "https://portaljack.freeddns.org/${html}" \ No newline at end of file +convert_to_html(){ + for md in *.md; do + [ -f "$md" ] || continue + filename="${md%.*}" + pandoc -o "$filename.html" "$md" + echo "Convertido: $md -> $filename.html" + done +} + +upload(){ + for html in *.html; do + [ -f "$html" ] || continue + cp "$html" /output/ + echo "✅ Publicado: $html" + done +} + +dependencies +convert_to_html +upload \ No newline at end of file