56 lines
1.7 KiB
Bash
Executable File
56 lines
1.7 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# --- Caricamento variabili d'ambiente ---
|
|
if [ -f .env ]; then
|
|
export $(grep -v '^#' .env | xargs)
|
|
else
|
|
echo "❌ Errore: File .env non trovato."
|
|
exit 1
|
|
fi
|
|
|
|
# --- Configurazione Parallelismo ---
|
|
THREADS=${1:-${FTP_THREADS:-30}}
|
|
|
|
# --- Configurazione FTP per ROOT www.canticristiani.it ---
|
|
FTP_HOST="ftp.canticristiani.it"
|
|
FTP_USER="canticristiani.it"
|
|
FTP_PASS="$FTP_PASSWORD"
|
|
REMOTE_DIR="" # Carica nella root della cartella FTP
|
|
|
|
if [ -z "$FTP_PASS" ]; then
|
|
echo "❌ Errore: FTP_PASSWORD non definita nel file .env"
|
|
exit 1
|
|
fi
|
|
|
|
# --- Aggiornamento Versione ---
|
|
VERSION=$(date +'%Y.%m.%d.%H%M')
|
|
echo "export const VERSION = '$VERSION';" > src/app/version.ts
|
|
echo "🏷️ Versione aggiornata a: $VERSION"
|
|
|
|
# --- Configurazione Email Parametrica ---
|
|
node -e "
|
|
const fs = require('fs');
|
|
const envEmail = process.env.CONTACT_EMAIL || 'info@canticristiani.it';
|
|
['src/environments/environment.ts', 'src/environments/environment.prod.ts'].forEach(file => {
|
|
if (fs.existsSync(file)) {
|
|
let content = fs.readFileSync(file, 'utf8');
|
|
content = content.replace(/contactEmail:\s*'[^']*'/g, \`contactEmail: '\${envEmail}'\`);
|
|
fs.writeFileSync(file, content, 'utf8');
|
|
console.log(\`📧 Aggiornata email di contatto in \${file} a: \${envEmail}\`);
|
|
}
|
|
});
|
|
"
|
|
|
|
|
|
# --- Build della PWA (base-href=/ per installare nella root) ---
|
|
echo "📦 1/2 Build della PWA (Production) per ROOT (www.canticristiani.it) in corso..."
|
|
npm run build -- --configuration=production --base-href=/ || { echo "❌ Errore nella build"; exit 1; }
|
|
|
|
if [ ! -d "www" ]; then
|
|
echo "❌ Errore: Cartella 'www' non trovata."
|
|
exit 1
|
|
fi
|
|
|
|
# --- Upload via FTP ---
|
|
python3 scratch/deploy_ftp.py
|