78 lines
No EOL
2 KiB
YAML
78 lines
No EOL
2 KiB
YAML
name: Build and Deploy Astro App
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: roadrunner
|
|
degfaults:
|
|
run:
|
|
working-directory: BluewaterBlog/blog
|
|
steps:
|
|
|
|
- name: Repository auschecken
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Wo sind wir?
|
|
run: |
|
|
cd blog
|
|
pwd
|
|
|
|
- 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://blauwasser-mausis.de.de)
|
|
if [ "$HTTP_STATUS" -eq 200 ]; then
|
|
echo "✅ App erreichbar unter https://blauwasser-mausis.de.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 blauwasser-mausis.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" |