Bluewaterblog/.forgejo/workflows/deploy.yml
ebby 84e787a422
Some checks failed
Build and Deploy Astro App / build (push) Failing after 50s
Build and Deploy Astro App / deploy (push) Has been skipped
astro config und deploy action
2026-07-08 09:19:12 +02:00

70 lines
No EOL
1.9 KiB
YAML

name: Build and Deploy Astro App
on:
push:
branches:
- main
jobs:
build:
runs-on: roadrunner
# Läuft im Podman-Container (node:22-bookworm)
steps:
- name: Repository auschecken
uses: actions/checkout@v4
- name: Node.js einrichten
uses: actions/setup-node@v4
with:
node-version: '22'
cache: 'npm'
- name: Abhängigkeiten installieren
run: npm ci
- name: Astro-Projekt bauen
run: npm run build
- name: Build-Artefakte hochladen
uses: actions/upload-artifact@v3
with:
name: astro-dist
path: dist/
deploy:
needs: build
runs-on: self-hosted
# Läuft direkt auf dem Host (nicht im Container)
steps:
- name: Build-Artefakte herunterladen
uses: actions/download-artifact@v3
with:
name: astro-dist
path: ./dist
- name: Auf Server deployen
run: |
echo "🚀 Deployment startet..."
rm -rf /var/www/astro-app/*
cp -r ./dist/* /var/www/astro-app/
# SELinux-Kontext wiederherstellen
restorecon -Rv /var/www/astro-app/
echo "✅ Deployment erfolgreich!"
- name: HTTPS-Erreichbarkeit prüfen
run: |
HTTP_STATUS=$(curl -s -o /dev/null -w "%{http_code}" https://app.deine-domain.de)
if [ "$HTTP_STATUS" -eq 200 ]; then
echo "✅ App erreichbar unter https://app.deine-domain.de (HTTP $HTTP_STATUS)"
else
echo "❌ App antwortet mit HTTP $HTTP_STATUS"
exit 1
fi
- name: TLS-Zertifikat prüfen
run: |
EXPIRY=$(echo | openssl s_client -connect app.deine-domain.de:443 \
-servername app.deine-domain.de 2>/dev/null \
| openssl x509 -noout -enddate 2>/dev/null \
| cut -d= -f2)
echo "🔒 Zertifikat gültig bis: $EXPIRY"