Test CI/CD pipeline1
Deploy Docusaurus / build-and-deploy (push) Failing after 0s
Details
Deploy Docusaurus / build-and-deploy (push) Failing after 0s
Details
This commit is contained in:
parent
7ea6cf4896
commit
4e5cd0ecfb
|
|
@ -10,35 +10,86 @@ jobs:
|
||||||
runs-on: docker
|
runs-on: docker
|
||||||
container:
|
container:
|
||||||
image: node:20-bookworm
|
image: node:20-bookworm
|
||||||
options: --volume /opt/forgejo/sites/docs:/deploy/docs
|
volumes:
|
||||||
|
- /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: npm install
|
run: |
|
||||||
|
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..."
|
||||||
|
|
||||||
# Crea la directory se non esiste
|
# Verifica esistenza directory
|
||||||
mkdir -p $TARGET_DIR
|
if [ ! -d "$TARGET_DIR" ]; then
|
||||||
|
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
|
# Permessi per Nginx (UID 101)
|
||||||
|
echo "🔐 Imposto permessi..."
|
||||||
|
chown -R 101:101 $TARGET_DIR
|
||||||
chmod -R 755 $TARGET_DIR
|
chmod -R 755 $TARGET_DIR
|
||||||
|
|
||||||
echo "Deploy completato con successo!"
|
echo "✅ Deploy completato!"
|
||||||
|
|
||||||
|
- 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