fix: Simplify Gitea variables and improve staging banner design
All checks were successful
Dev Deployment (Zero Downtime) / deploy-dev (push) Successful in 13m7s
All checks were successful
Dev Deployment (Zero Downtime) / deploy-dev (push) Successful in 13m7s
- Remove branch-specific variable names (not needed) - Each workflow uses its own default based on branch - Users only need to set general variables, not branch-specific ones - Redesign staging banner as floating box in bottom-right corner - Better UX: doesn't block content, dismissible, modern design
This commit is contained in:
@@ -101,8 +101,8 @@ jobs:
|
|||||||
echo "✅ Dev deployment completed!"
|
echo "✅ Dev deployment completed!"
|
||||||
env:
|
env:
|
||||||
NODE_ENV: staging
|
NODE_ENV: staging
|
||||||
LOG_LEVEL: ${{ vars.LOG_LEVEL_DEV || vars.LOG_LEVEL || 'debug' }}
|
LOG_LEVEL: ${{ vars.LOG_LEVEL || 'debug' }}
|
||||||
NEXT_PUBLIC_BASE_URL: ${{ vars.NEXT_PUBLIC_BASE_URL_DEV || vars.NEXT_PUBLIC_BASE_URL || 'https://dev.dk0.dev' }}
|
NEXT_PUBLIC_BASE_URL: ${{ vars.NEXT_PUBLIC_BASE_URL || 'https://dev.dk0.dev' }}
|
||||||
MY_EMAIL: ${{ vars.MY_EMAIL }}
|
MY_EMAIL: ${{ vars.MY_EMAIL }}
|
||||||
MY_INFO_EMAIL: ${{ vars.MY_INFO_EMAIL }}
|
MY_INFO_EMAIL: ${{ vars.MY_INFO_EMAIL }}
|
||||||
MY_PASSWORD: ${{ secrets.MY_PASSWORD }}
|
MY_PASSWORD: ${{ secrets.MY_PASSWORD }}
|
||||||
|
|||||||
@@ -103,8 +103,8 @@ jobs:
|
|||||||
echo "✅ Production deployment completed with zero downtime!"
|
echo "✅ Production deployment completed with zero downtime!"
|
||||||
env:
|
env:
|
||||||
NODE_ENV: production
|
NODE_ENV: production
|
||||||
LOG_LEVEL: ${{ vars.LOG_LEVEL_PRODUCTION || vars.LOG_LEVEL || 'info' }}
|
LOG_LEVEL: ${{ vars.LOG_LEVEL || 'info' }}
|
||||||
NEXT_PUBLIC_BASE_URL: ${{ vars.NEXT_PUBLIC_BASE_URL_PRODUCTION || vars.NEXT_PUBLIC_BASE_URL || 'https://dk0.dev' }}
|
NEXT_PUBLIC_BASE_URL: ${{ vars.NEXT_PUBLIC_BASE_URL || 'https://dk0.dev' }}
|
||||||
MY_EMAIL: ${{ vars.MY_EMAIL }}
|
MY_EMAIL: ${{ vars.MY_EMAIL }}
|
||||||
MY_INFO_EMAIL: ${{ vars.MY_INFO_EMAIL }}
|
MY_INFO_EMAIL: ${{ vars.MY_INFO_EMAIL }}
|
||||||
MY_PASSWORD: ${{ secrets.MY_PASSWORD }}
|
MY_PASSWORD: ${{ secrets.MY_PASSWORD }}
|
||||||
|
|||||||
@@ -44,62 +44,66 @@ Für den `dev` Branch brauchst du die **gleichen** Variablen, aber mit anderen W
|
|||||||
- `ADMIN_BASIC_AUTH` = `admin:staging_password` (kann anders sein)
|
- `ADMIN_BASIC_AUTH` = `admin:staging_password` (kann anders sein)
|
||||||
- `N8N_SECRET_TOKEN` = Dein n8n Secret Token (optional)
|
- `N8N_SECRET_TOKEN` = Dein n8n Secret Token (optional)
|
||||||
|
|
||||||
## ⚠️ Problem: Gitea unterstützt keine branch-spezifischen Variablen
|
## ✅ Lösung: Automatische Branch-Erkennung
|
||||||
|
|
||||||
**Gitea hat keine eingebaute Funktion für branch-spezifische Variablen!**
|
**Gitea unterstützt keine branch-spezifischen Variablen, aber die Workflows erkennen automatisch den Branch!**
|
||||||
|
|
||||||
### Lösung 1: Separate Variablen (Empfohlen)
|
### Wie es funktioniert:
|
||||||
|
|
||||||
Du kannst Variablen mit Suffixen erstellen:
|
Die Workflows triggern auf unterschiedlichen Branches und verwenden automatisch die richtigen Defaults:
|
||||||
|
|
||||||
**Variables:**
|
|
||||||
- `NEXT_PUBLIC_BASE_URL_PRODUCTION` = `https://dk0.dev`
|
|
||||||
- `NEXT_PUBLIC_BASE_URL_DEV` = `https://dev.dk0.dev`
|
|
||||||
- `LOG_LEVEL_PRODUCTION` = `info`
|
|
||||||
- `LOG_LEVEL_DEV` = `debug`
|
|
||||||
|
|
||||||
Dann musst du die Workflows anpassen, um die richtige Variable zu verwenden.
|
|
||||||
|
|
||||||
### Lösung 2: Workflow-spezifische Werte (Aktuell implementiert)
|
|
||||||
|
|
||||||
Die Workflows haben bereits **Hardcoded Defaults**:
|
|
||||||
|
|
||||||
**Production Workflow** (`.gitea/workflows/production-deploy.yml`):
|
**Production Workflow** (`.gitea/workflows/production-deploy.yml`):
|
||||||
```yaml
|
- Triggert nur auf `production` Branch
|
||||||
NEXT_PUBLIC_BASE_URL: ${{ vars.NEXT_PUBLIC_BASE_URL || 'https://dk0.dev' }}
|
- Verwendet: `NEXT_PUBLIC_BASE_URL` (wenn gesetzt) oder Default: `https://dk0.dev`
|
||||||
```
|
|
||||||
|
|
||||||
**Dev Workflow** (`.gitea/workflows/dev-deploy.yml`):
|
**Dev Workflow** (`.gitea/workflows/dev-deploy.yml`):
|
||||||
```yaml
|
- Triggert nur auf `dev` Branch
|
||||||
NEXT_PUBLIC_BASE_URL: ${{ vars.NEXT_PUBLIC_BASE_URL || 'https://dev.dk0.dev' }}
|
- Verwendet: `NEXT_PUBLIC_BASE_URL` (wenn gesetzt) oder Default: `https://dev.dk0.dev`
|
||||||
```
|
|
||||||
|
|
||||||
**Das bedeutet:**
|
**Das bedeutet:**
|
||||||
- Wenn `NEXT_PUBLIC_BASE_URL` in Gitea gesetzt ist → wird verwendet
|
- Du setzt **eine** Variable `NEXT_PUBLIC_BASE_URL` in Gitea
|
||||||
- Wenn **nicht** gesetzt → verwendet den Default (Production: `dk0.dev`, Dev: `dev.dk0.dev`)
|
- **Production Branch** → verwendet diese Variable (oder Default `https://dk0.dev`)
|
||||||
|
- **Dev Branch** → verwendet diese Variable (oder Default `https://dev.dk0.dev`)
|
||||||
|
|
||||||
## ✅ Empfohlene Konfiguration (JETZT IMPLEMENTIERT!)
|
### ⚠️ WICHTIG:
|
||||||
|
|
||||||
Die Workflows unterstützen jetzt **branch-spezifische Variablen**:
|
Da beide Workflows die **gleiche Variable** verwenden, aber unterschiedliche Defaults haben:
|
||||||
|
|
||||||
### Für Production:
|
**Option 1: Variable NICHT setzen (Empfohlen)**
|
||||||
Setze in Gitea Variables:
|
- Production verwendet automatisch: `https://dk0.dev`
|
||||||
- `NEXT_PUBLIC_BASE_URL_PRODUCTION` = `https://dk0.dev` ⭐ **Empfohlen**
|
- Dev verwendet automatisch: `https://dev.dk0.dev`
|
||||||
- ODER `NEXT_PUBLIC_BASE_URL` = `https://dk0.dev` (Fallback)
|
- ✅ Funktioniert perfekt ohne Konfiguration!
|
||||||
- `LOG_LEVEL_PRODUCTION` = `info` (optional)
|
|
||||||
- ODER `LOG_LEVEL` = `info` (Fallback)
|
|
||||||
|
|
||||||
### Für Dev:
|
**Option 2: Variable setzen**
|
||||||
Setze in Gitea Variables:
|
- Wenn du `NEXT_PUBLIC_BASE_URL` = `https://dk0.dev` setzt
|
||||||
- `NEXT_PUBLIC_BASE_URL_DEV` = `https://dev.dk0.dev` ⭐ **Empfohlen**
|
- Dann verwendet **beide** Branches diese URL (nicht ideal für Dev)
|
||||||
- ODER `NEXT_PUBLIC_BASE_URL` = `https://dev.dk0.dev` (Fallback)
|
- ⚠️ Nicht empfohlen, da Dev dann die Production-URL verwendet
|
||||||
- `LOG_LEVEL_DEV` = `debug` (optional)
|
|
||||||
- ODER `LOG_LEVEL` = `debug` (Fallback)
|
|
||||||
|
|
||||||
### Fallback-Logik:
|
## ✅ Empfohlene Konfiguration
|
||||||
1. Zuerst wird die branch-spezifische Variable geprüft (`NEXT_PUBLIC_BASE_URL_PRODUCTION` / `NEXT_PUBLIC_BASE_URL_DEV`)
|
|
||||||
2. Falls nicht gesetzt, wird die allgemeine Variable verwendet (`NEXT_PUBLIC_BASE_URL`)
|
### ⭐ Einfachste Lösung: NICHTS setzen!
|
||||||
3. Falls auch die nicht gesetzt ist, wird der Default verwendet (`https://dk0.dev` / `https://dev.dk0.dev`)
|
|
||||||
|
Die Workflows haben bereits die richtigen Defaults:
|
||||||
|
- **Production Branch** → automatisch `https://dk0.dev`
|
||||||
|
- **Dev Branch** → automatisch `https://dev.dk0.dev`
|
||||||
|
|
||||||
|
Du musst **NICHTS** in Gitea setzen, es funktioniert automatisch!
|
||||||
|
|
||||||
|
### Wenn du Variablen setzen willst:
|
||||||
|
|
||||||
|
**Nur diese Variablen setzen (für beide Branches):**
|
||||||
|
- `MY_EMAIL` = `contact@dk0.dev`
|
||||||
|
- `MY_INFO_EMAIL` = `info@dk0.dev`
|
||||||
|
- `LOG_LEVEL` = `info` (wird für Production verwendet, Dev überschreibt mit `debug`)
|
||||||
|
|
||||||
|
**Secrets (für beide Branches):**
|
||||||
|
- `MY_PASSWORD` = Dein Email-Passwort
|
||||||
|
- `MY_INFO_PASSWORD` = Dein Info-Email-Passwort
|
||||||
|
- `ADMIN_BASIC_AUTH` = `admin:dein_passwort`
|
||||||
|
- `N8N_SECRET_TOKEN` = Dein n8n Token (optional)
|
||||||
|
|
||||||
|
**⚠️ NICHT setzen:**
|
||||||
|
- `NEXT_PUBLIC_BASE_URL` - Lass diese Variable leer, damit jeder Branch seinen eigenen Default verwendet!
|
||||||
|
|
||||||
## 📝 Schritt-für-Schritt Anleitung
|
## 📝 Schritt-für-Schritt Anleitung
|
||||||
|
|
||||||
@@ -125,24 +129,26 @@ https://git.dk0.dev/denshooter/portfolio/settings
|
|||||||
|
|
||||||
## 🔄 Aktuelle Workflow-Logik
|
## 🔄 Aktuelle Workflow-Logik
|
||||||
|
|
||||||
Die Workflows verwenden diese Logik:
|
Die Workflows verwenden diese einfache Logik:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
# Production
|
# Production Workflow (triggert nur auf production branch)
|
||||||
NEXT_PUBLIC_BASE_URL: ${{ vars.NEXT_PUBLIC_BASE_URL_PRODUCTION || vars.NEXT_PUBLIC_BASE_URL || 'https://dk0.dev' }}
|
NEXT_PUBLIC_BASE_URL: ${{ vars.NEXT_PUBLIC_BASE_URL || 'https://dk0.dev' }}
|
||||||
|
|
||||||
# Dev
|
# Dev Workflow (triggert nur auf dev branch)
|
||||||
NEXT_PUBLIC_BASE_URL: ${{ vars.NEXT_PUBLIC_BASE_URL_DEV || vars.NEXT_PUBLIC_BASE_URL || 'https://dev.dk0.dev' }}
|
NEXT_PUBLIC_BASE_URL: ${{ vars.NEXT_PUBLIC_BASE_URL || 'https://dev.dk0.dev' }}
|
||||||
```
|
```
|
||||||
|
|
||||||
**Das bedeutet:**
|
**Das bedeutet:**
|
||||||
1. **Production** sucht zuerst nach `NEXT_PUBLIC_BASE_URL_PRODUCTION`, dann `NEXT_PUBLIC_BASE_URL`, dann Default
|
- Jeder Workflow hat seinen **eigenen Default**
|
||||||
2. **Dev** sucht zuerst nach `NEXT_PUBLIC_BASE_URL_DEV`, dann `NEXT_PUBLIC_BASE_URL`, dann Default
|
- Wenn `NEXT_PUBLIC_BASE_URL` in Gitea gesetzt ist, wird diese verwendet
|
||||||
|
- Wenn **nicht** gesetzt, verwendet jeder Branch seinen eigenen Default
|
||||||
|
|
||||||
**Empfehlung:**
|
**⭐ Beste Lösung:**
|
||||||
- Setze `NEXT_PUBLIC_BASE_URL_PRODUCTION` = `https://dk0.dev` für Production
|
- **NICHT** `NEXT_PUBLIC_BASE_URL` in Gitea setzen
|
||||||
- Setze `NEXT_PUBLIC_BASE_URL_DEV` = `https://dev.dk0.dev` für Dev
|
- Dann verwendet Production automatisch `https://dk0.dev`
|
||||||
- So kannst du beide Branches unabhängig konfigurieren!
|
- Und Dev verwendet automatisch `https://dev.dk0.dev`
|
||||||
|
- ✅ Perfekt getrennt, ohne Konfiguration!
|
||||||
|
|
||||||
## 🎯 Best Practice
|
## 🎯 Best Practice
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
'use client';
|
'use client';
|
||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { motion } from 'framer-motion';
|
import { motion, AnimatePresence } from 'framer-motion';
|
||||||
import { AlertTriangle, X } from 'lucide-react';
|
import { AlertTriangle, X } from 'lucide-react';
|
||||||
|
|
||||||
export function StagingBanner() {
|
export function StagingBanner() {
|
||||||
@@ -31,32 +31,43 @@ export function StagingBanner() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<motion.div
|
<AnimatePresence>
|
||||||
initial={{ y: -100, opacity: 0 }}
|
<motion.div
|
||||||
animate={{ y: 0, opacity: 1 }}
|
initial={{ scale: 0, opacity: 0, x: 20, y: 20 }}
|
||||||
exit={{ y: -100, opacity: 0 }}
|
animate={{ scale: 1, opacity: 1, x: 0, y: 0 }}
|
||||||
className="fixed top-0 left-0 right-0 z-50 bg-gradient-to-r from-yellow-500 via-orange-500 to-red-500 text-white shadow-lg"
|
exit={{ scale: 0, opacity: 0 }}
|
||||||
>
|
transition={{ type: "spring", damping: 20, stiffness: 300 }}
|
||||||
<div className="container mx-auto px-4 py-2 md:py-3 flex items-center justify-between gap-4">
|
className="fixed bottom-6 right-6 z-50 max-w-sm"
|
||||||
<div className="flex items-center gap-3">
|
>
|
||||||
<AlertTriangle className="w-5 h-5 animate-pulse flex-shrink-0" />
|
<div className="bg-gradient-to-br from-yellow-500 via-orange-500 to-red-500 text-white rounded-xl shadow-2xl border-2 border-white/20 backdrop-blur-sm overflow-hidden">
|
||||||
<div className="flex-1 min-w-0">
|
{/* Header */}
|
||||||
<p className="font-bold text-sm md:text-base">
|
<div className="bg-black/20 px-4 py-2 flex items-center justify-between">
|
||||||
🧪 TEST / DEVELOPMENT VERSION
|
<div className="flex items-center gap-2">
|
||||||
|
<AlertTriangle className="w-4 h-4 animate-pulse" />
|
||||||
|
<span className="font-bold text-xs uppercase tracking-wide">
|
||||||
|
Test Environment
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<button
|
||||||
|
onClick={() => setIsVisible(false)}
|
||||||
|
className="p-1 hover:bg-white/20 rounded transition-colors"
|
||||||
|
aria-label="Close banner"
|
||||||
|
>
|
||||||
|
<X className="w-3 h-3" />
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* Content */}
|
||||||
|
<div className="px-4 py-3">
|
||||||
|
<p className="text-sm font-semibold mb-1">
|
||||||
|
🧪 Development Version
|
||||||
</p>
|
</p>
|
||||||
<p className="text-xs md:text-sm text-white/90">
|
<p className="text-xs text-white/90 leading-relaxed">
|
||||||
This is a staging environment. Not production-ready. Data may be unstable.
|
This is a staging environment. Not production-ready. Data may be unstable.
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<button
|
</motion.div>
|
||||||
onClick={() => setIsVisible(false)}
|
</AnimatePresence>
|
||||||
className="p-1 hover:bg-white/20 rounded transition-colors"
|
|
||||||
aria-label="Close banner"
|
|
||||||
>
|
|
||||||
<X className="w-4 h-4" />
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</motion.div>
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user