This commit is contained in:
Kristina 2026-05-16 18:40:45 +02:00
parent ea664b0c70
commit 1617974db1
2 changed files with 34 additions and 14 deletions

View file

@ -1,7 +1,10 @@
name: Deploy HTML name: MD a HTML y deploy Apache
on: on:
push: push:
branches: [main] branches: [main]
paths:
- '**.md'
jobs: jobs:
deploy: deploy:
@ -10,10 +13,11 @@ jobs:
image: ubuntu:22.04 image: ubuntu:22.04
volumes: volumes:
- /srv/devops/data/apache/htdocs:/output - /srv/devops/data/apache/htdocs:/output
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Convertir y desplegar - name: Convertir y publicar
run: | run: |
chmod +x convertir.sh chmod +x convertir.sh
./convertir.sh ./convertir.sh

View file

@ -1,12 +1,28 @@
-#!/bin/sh #!/bin/bash
+#!/bin/bash set -euo pipefail
+set -euo pipefail
- for MD in $(ls *.md) dependencies(){
+ for md in *.md; do apt-get update -qq
+ [ -f "$md" ] || continue apt-get install -y -qq pandoc
}
- echo "USAR scp O ftp O CUALQUIER OTRA COSA PARA SUBIR LOS HTML: $HTML" convert_to_html(){
- cat $HTML for md in *.md; do
+ cp "$html" /output/ [ -f "$md" ] || continue
+ echo "https://portaljack.freeddns.org/${html}" 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