This commit is contained in:
1 parent
f018f85dec
commit
641a60fb74
1 file changed
+12
-10
@@ -24,21 +24,27 @@ jobs:
|
||||
}
|
||||
trap 'error_handler $LINENO' ERR
|
||||
|
||||
# Zorg dat de permanente opslagmap voor álle public assets bestaat
|
||||
# Zorg dat de permanente opslagmap buiten het project bestaat
|
||||
sudo mkdir -p /var/www/atom-media
|
||||
sudo chown -R www-data:www-data /var/www/atom-media
|
||||
sudo chmod -R 775 /var/www/atom-media
|
||||
|
||||
# [CRUCIAL STEP]: Red de huidige live uploads (nieuws, logo's) EERST voordat Git of de build iets wist
|
||||
cd /var/www/atom-nexst/
|
||||
if [ -d .next/standalone/public ]; then
|
||||
echo "Backing up current live images and uploads..."
|
||||
rsync -av --ignore-existing .next/standalone/public/ /var/www/atom-media/ || true
|
||||
fi
|
||||
|
||||
# 2. Cleanup & Git Sync
|
||||
docker image prune -f
|
||||
cd /var/www/atom-nexst/
|
||||
git config --global --add safe.directory /var/www/atom-nexst
|
||||
git remote set-url origin /docker/gitea/gitea/git/repositories/remco/epicnext-cms.git/
|
||||
|
||||
git fetch origin --prune
|
||||
git reset --hard origin/main
|
||||
|
||||
# We sluiten nu de gehele public map uit van git clean, zodat live uploads (zoals het logo) behouden blijven
|
||||
# Sluit de public map uit zodat Git clean de lokale werkmap niet leegtrekt
|
||||
git clean -fd -e .env -e .env.local -e .env.production -e .env*.local -e .next -e public
|
||||
|
||||
# Verwijder oude builds, behoud de cache voor snelheid
|
||||
@@ -67,19 +73,15 @@ jobs:
|
||||
# 6. Sync Standalone Bundle
|
||||
echo "Preparing standalone bundle paths..."
|
||||
|
||||
# Synchroniseer eerst eventuele nieuwe logo's/bestanden die via de live site zijn geüpload terug naar onze back-up map
|
||||
if [ -d .next/standalone/public ]; then
|
||||
rsync -av --ignore-existing .next/standalone/public/ /var/www/atom-media/ || true
|
||||
fi
|
||||
|
||||
# Bouw de standalone map op
|
||||
# Kopieer de schone, nieuw gebouwde public-map naar standalone
|
||||
cp -r public .next/standalone/
|
||||
cp -r .next/static .next/standalone/.next/
|
||||
cp -r node_modules/@prisma .next/standalone/node_modules/ 2>/dev/null || true
|
||||
cp .env .next/standalone/.env
|
||||
|
||||
# Synchroniseer alle bewaarde media en logo's over de vers gebouwde public map heen
|
||||
# Kopieer nu alle bewaarde nieuws-images, logo's en uploads terug over de standalone public-map heen
|
||||
if [ -d /var/www/atom-media ]; then
|
||||
echo "Restoring all news images and uploads to production..."
|
||||
rsync -av /var/www/atom-media/ .next/standalone/public/
|
||||
fi
|
||||
|
||||
|
||||
Reference in new issue
Block a user