Files
Hugo_MAP-NSU-Komplex/.gitea/workflows/deploy.yml
T

49 lines
1.5 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
name: Build & Deploy Website
# Hugo-Projekt (kein Node!). Baut das Image via Dockerfile (Hugo-Build im Container)
# und startet den nginx-Container (Port 8066) neu. Runner + nginx laufen auf 10.161.30.38.
on:
push:
branches: [main]
workflow_dispatch: {}
concurrency:
group: deploy-main
cancel-in-progress: true
jobs:
deploy:
# WICHTIG: Muss zu einem Label deines Gitea-Runners passen (Gitea → Admin/Repo → Runners).
# Der Runner braucht Zugriff auf Docker (Host-Runner ODER Container-Runner mit
# gemountetem /var/run/docker.sock). Ohne Docker-Zugriff schlägt der Deploy fehl.
runs-on: ubuntu-latest
steps:
- name: Checkout inkl. Git LFS
uses: actions/checkout@v4
with:
lfs: true # ZWINGEND sonst kommen LFS-Pointer statt Bilder/Fonts an
fetch-depth: 1
- name: LFS-Dateien holen
run: git lfs pull
- name: Container bauen & neu starten
run: docker compose up -d --build --remove-orphans
- name: Alte Images aufräumen
run: docker image prune -f
- name: Healthcheck (:8066)
run: |
for i in $(seq 1 20); do
if wget -qO- http://localhost:8066/ >/dev/null 2>&1; then
echo "OK: Seite antwortet auf :8066"; exit 0
fi
echo "warte auf Container … ($i/20)"; sleep 3
done
echo "FEHLER: Seite antwortet nicht auf :8066"
docker compose logs --tail=50 || true
exit 1