From 84e787a4229f31fda361d2f31290d51e86af1df2 Mon Sep 17 00:00:00 2001 From: ebby Date: Wed, 8 Jul 2026 09:19:12 +0200 Subject: [PATCH] astro config und deploy action --- .forgejo/workflows/deploy.yml | 70 +++++++++++++++++++++++++++++++++++ .forgejo/workflows/test.yml | 41 -------------------- blog/astro.config.mjs | 8 +++- 3 files changed, 77 insertions(+), 42 deletions(-) create mode 100644 .forgejo/workflows/deploy.yml delete mode 100644 .forgejo/workflows/test.yml diff --git a/.forgejo/workflows/deploy.yml b/.forgejo/workflows/deploy.yml new file mode 100644 index 0000000..6b3dae4 --- /dev/null +++ b/.forgejo/workflows/deploy.yml @@ -0,0 +1,70 @@ +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" \ No newline at end of file diff --git a/.forgejo/workflows/test.yml b/.forgejo/workflows/test.yml deleted file mode 100644 index 1c5f5b7..0000000 --- a/.forgejo/workflows/test.yml +++ /dev/null @@ -1,41 +0,0 @@ -name: Build and Test - -on: - push: - branches: - - main - -jobs: - - build-and-test: - runs-on: podman - permissions: - contents: write - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Setup Node - uses: actions/setup-node@v4 - with: - node-version: 20 - - - name: Cache dependencies - uses: actions/cache@v4 - with: - path: ~/.npm - key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} - restore-keys: | - ${{ runner.os }}-node- - - - run: npm ci - - - name: Check types and style - run: npm run check - - - name: Test - run: npm test - - - name: Ensure build wokrs - run: npm run dev \ No newline at end of file diff --git a/blog/astro.config.mjs b/blog/astro.config.mjs index e762ba5..2bdd946 100644 --- a/blog/astro.config.mjs +++ b/blog/astro.config.mjs @@ -2,4 +2,10 @@ import { defineConfig } from 'astro/config'; // https://astro.build/config -export default defineConfig({}); +export default defineConfig({ + site: 'https://blauwasser-mausis.de', + output: 'static', + build: { + assets: '_assets', + }, + });