Compare commits
No commits in common. "4e5cd0ecfbf9cfd1dc8907038fd407b344d3521d" and "b2ec24f9885091ce3265a65cd66cd5a0ca47a49a" have entirely different histories.
4e5cd0ecfb
...
b2ec24f988
|
|
@ -10,86 +10,35 @@ jobs:
|
||||||
runs-on: docker
|
runs-on: docker
|
||||||
container:
|
container:
|
||||||
image: node:20-bookworm
|
image: node:20-bookworm
|
||||||
volumes:
|
options: --volume /opt/forgejo/sites/docs:/deploy/docs
|
||||||
- /opt/forgejo/sites/docs:/deploy/docs
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout del codice
|
- name: Checkout del codice
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Cache Node Modules
|
|
||||||
uses: actions/cache@v4
|
|
||||||
with:
|
|
||||||
path: node_modules
|
|
||||||
key: npm-${{ hashFiles('package-lock.json') }}
|
|
||||||
restore-keys: |
|
|
||||||
npm-
|
|
||||||
|
|
||||||
- name: Installazione Dipendenze
|
- name: Installazione Dipendenze
|
||||||
run: |
|
run: npm install
|
||||||
if [ -d "node_modules" ]; then
|
|
||||||
echo "📦 Cache hit - dipendenze già presenti"
|
|
||||||
else
|
|
||||||
echo "📥 Cache miss - scarico dipendenze..."
|
|
||||||
fi
|
|
||||||
npm ci --prefer-offline
|
|
||||||
|
|
||||||
- name: Build Docusaurus
|
- name: Build Docusaurus
|
||||||
run: |
|
run: |
|
||||||
export NODE_OPTIONS="--max-old-space-size=4096"
|
export NODE_OPTIONS="--max-old-space-size=4096"
|
||||||
echo "🔨 Avvio build..."
|
|
||||||
npm run build
|
npm run build
|
||||||
echo "✅ Build completato!"
|
|
||||||
echo "📊 Files generati: $(find build -type f | wc -l)"
|
|
||||||
|
|
||||||
- name: Pubblica sul Server
|
- name: Pubblica sul Server
|
||||||
run: |
|
run: |
|
||||||
TARGET_DIR="/deploy/docs"
|
TARGET_DIR="/deploy/docs"
|
||||||
echo "🚀 Inizio deploy su $TARGET_DIR..."
|
echo "Inizio deploy su $TARGET_DIR..."
|
||||||
|
|
||||||
# Verifica esistenza directory
|
# Crea la directory se non esiste
|
||||||
if [ ! -d "$TARGET_DIR" ]; then
|
mkdir -p $TARGET_DIR
|
||||||
echo "❌ ERRORE: $TARGET_DIR non esiste!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Pulisce la cartella di destinazione
|
# Pulisce la cartella di destinazione
|
||||||
echo "🧹 Pulizia directory..."
|
|
||||||
rm -rf $TARGET_DIR/*
|
rm -rf $TARGET_DIR/*
|
||||||
|
|
||||||
# Copia i nuovi file
|
# Copia i nuovi file
|
||||||
echo "📋 Copia files..."
|
|
||||||
cp -r build/* $TARGET_DIR/
|
cp -r build/* $TARGET_DIR/
|
||||||
|
|
||||||
# Permessi per Nginx (UID 101)
|
# Permessi per Nginx
|
||||||
echo "🔐 Imposto permessi..."
|
|
||||||
chown -R 101:101 $TARGET_DIR
|
|
||||||
chmod -R 755 $TARGET_DIR
|
chmod -R 755 $TARGET_DIR
|
||||||
|
|
||||||
echo "✅ Deploy completato!"
|
echo "Deploy completato con successo!"
|
||||||
|
|
||||||
- name: Notifica Deploy
|
|
||||||
if: success()
|
|
||||||
run: |
|
|
||||||
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
||||||
echo "✅ Sito deployato con successo!"
|
|
||||||
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
||||||
echo "🌐 URL: http://192.168.1.245:8080"
|
|
||||||
echo "📦 Commit: ${{ gitea.sha }}"
|
|
||||||
echo "👤 Author: ${{ gitea.actor }}"
|
|
||||||
echo "📅 Data: $(date '+%Y-%m-%d %H:%M:%S')"
|
|
||||||
echo "🔖 Branch: ${{ gitea.ref_name }}"
|
|
||||||
echo "📊 Files totali: $(find /deploy/docs -type f | wc -l)"
|
|
||||||
echo "💾 Dimensione: $(du -sh /deploy/docs | cut -f1)"
|
|
||||||
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
||||||
|
|
||||||
- name: Notifica Errore
|
|
||||||
if: failure()
|
|
||||||
run: |
|
|
||||||
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
||||||
echo "❌ Deploy FALLITO!"
|
|
||||||
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
||||||
echo "📦 Commit: ${{ gitea.sha }}"
|
|
||||||
echo "👤 Author: ${{ gitea.actor }}"
|
|
||||||
echo "📅 Data: $(date '+%Y-%m-%d %H:%M:%S')"
|
|
||||||
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
||||||
Loading…
Reference in New Issue