astro config und deploy action
This commit is contained in:
parent
c5f632a175
commit
84e787a422
3 changed files with 77 additions and 42 deletions
70
.forgejo/workflows/deploy.yml
Normal file
70
.forgejo/workflows/deploy.yml
Normal file
|
|
@ -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"
|
||||||
|
|
@ -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
|
|
||||||
|
|
@ -2,4 +2,10 @@
|
||||||
import { defineConfig } from 'astro/config';
|
import { defineConfig } from 'astro/config';
|
||||||
|
|
||||||
// https://astro.build/config
|
// https://astro.build/config
|
||||||
export default defineConfig({});
|
export default defineConfig({
|
||||||
|
site: 'https://blauwasser-mausis.de',
|
||||||
|
output: 'static',
|
||||||
|
build: {
|
||||||
|
assets: '_assets',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue