From f4e59486ed50236ee054c30737f02aa243fc544e Mon Sep 17 00:00:00 2001 From: Niko Date: Sat, 21 Jun 2025 15:35:46 +0200 Subject: [PATCH 1/7] Add Makefile --- Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Makefile b/Makefile index 69cff0ff1..25152bccf 100644 --- a/Makefile +++ b/Makefile @@ -57,6 +57,8 @@ preview: $(REMOTE_CMD) "cd $(RELEASES_DIR) && ln -snf $(TIMESTAMP) current" @echo "\n\n**** Preview complete.\n\n" @echo "Open the preview site at: $(PREVIEW_SITE_URL)\n\n" + @echo "\n**** Cleaning up old releases (keep latest 3, skip 'current')...\n" + $(REMOTE_CMD) bash -c "'cd $(RELEASES_DIR) && ls -1dt */ | grep -v \"^current/?$$\" | grep -v \"^$(TIMESTAMP)/$$\" | tail -n +4 | xargs -r echo rm -rf'" | tee /dev/stdout ifeq ($(FORCE_DEPLOY), true) From 329b9d566368537c76a32ad31cc1b07fdddee957 Mon Sep 17 00:00:00 2001 From: Niko Date: Sat, 21 Jun 2025 15:47:09 +0200 Subject: [PATCH 2/7] whatever --- Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile b/Makefile index 25152bccf..40390e552 100644 --- a/Makefile +++ b/Makefile @@ -59,6 +59,7 @@ preview: @echo "Open the preview site at: $(PREVIEW_SITE_URL)\n\n" @echo "\n**** Cleaning up old releases (keep latest 3, skip 'current')...\n" $(REMOTE_CMD) bash -c "'cd $(RELEASES_DIR) && ls -1dt */ | grep -v \"^current/?$$\" | grep -v \"^$(TIMESTAMP)/$$\" | tail -n +4 | xargs -r echo rm -rf'" | tee /dev/stdout + @echo "whatever" ifeq ($(FORCE_DEPLOY), true) From e8b7155f12b2e2d5cda2a44cff4bdf5bcd3329d4 Mon Sep 17 00:00:00 2001 From: Niko Date: Sat, 21 Jun 2025 15:51:32 +0200 Subject: [PATCH 3/7] whatever --- Makefile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 40390e552..9fba5c88e 100644 --- a/Makefile +++ b/Makefile @@ -58,8 +58,7 @@ preview: @echo "\n\n**** Preview complete.\n\n" @echo "Open the preview site at: $(PREVIEW_SITE_URL)\n\n" @echo "\n**** Cleaning up old releases (keep latest 3, skip 'current')...\n" - $(REMOTE_CMD) bash -c "'cd $(RELEASES_DIR) && ls -1dt */ | grep -v \"^current/?$$\" | grep -v \"^$(TIMESTAMP)/$$\" | tail -n +4 | xargs -r echo rm -rf'" | tee /dev/stdout - @echo "whatever" + $(REMOTE_CMD) bash -c "'cd $(RELEASES_DIR) && ls -1dt */ | grep -v \"^current/?$$\" | grep -v \"^$(TIMESTAMP)/$$\" | xargs -r echo rm -rf'" | tee /dev/stdout ifeq ($(FORCE_DEPLOY), true) From e3db70280197397d9b200d5c51d2666ebfe32c76 Mon Sep 17 00:00:00 2001 From: Niko Date: Sat, 21 Jun 2025 15:57:49 +0200 Subject: [PATCH 4/7] Update cleanup command --- Makefile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 9fba5c88e..e1615d786 100644 --- a/Makefile +++ b/Makefile @@ -58,7 +58,10 @@ preview: @echo "\n\n**** Preview complete.\n\n" @echo "Open the preview site at: $(PREVIEW_SITE_URL)\n\n" @echo "\n**** Cleaning up old releases (keep latest 3, skip 'current')...\n" - $(REMOTE_CMD) bash -c "'cd $(RELEASES_DIR) && ls -1dt */ | grep -v \"^current/?$$\" | grep -v \"^$(TIMESTAMP)/$$\" | xargs -r echo rm -rf'" | tee /dev/stdout + $(REMOTE_CMD) 'bash -c "cd $(RELEASES_DIR) && \ + for dir in $(ls -1dt */ | sed \"s:/*$$::\" | grep -v ^current$$ | grep -v ^$(TIMESTAMP)$$ | tail -n +2); do \ + echo rm -rf \"$$dir\"; \ + done"' | tee /dev/stdout ifeq ($(FORCE_DEPLOY), true) From bc70e74c0f08af6c421ebd17226aba404637f336 Mon Sep 17 00:00:00 2001 From: Niko Date: Sat, 21 Jun 2025 16:08:35 +0200 Subject: [PATCH 5/7] testing --- Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile b/Makefile index e1615d786..d16ef057f 100644 --- a/Makefile +++ b/Makefile @@ -62,6 +62,7 @@ preview: for dir in $(ls -1dt */ | sed \"s:/*$$::\" | grep -v ^current$$ | grep -v ^$(TIMESTAMP)$$ | tail -n +2); do \ echo rm -rf \"$$dir\"; \ done"' | tee /dev/stdout + @echo "Need more" ifeq ($(FORCE_DEPLOY), true) From 01457936bd37fb2fc17adf9069f4506a640ada10 Mon Sep 17 00:00:00 2001 From: Niko Date: Sat, 21 Jun 2025 16:15:07 +0200 Subject: [PATCH 6/7] testing --- Makefile | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index d16ef057f..966060181 100644 --- a/Makefile +++ b/Makefile @@ -58,11 +58,17 @@ preview: @echo "\n\n**** Preview complete.\n\n" @echo "Open the preview site at: $(PREVIEW_SITE_URL)\n\n" @echo "\n**** Cleaning up old releases (keep latest 3, skip 'current')...\n" - $(REMOTE_CMD) 'bash -c "cd $(RELEASES_DIR) && \ - for dir in $(ls -1dt */ | sed \"s:/*$$::\" | grep -v ^current$$ | grep -v ^$(TIMESTAMP)$$ | tail -n +2); do \ - echo rm -rf \"$$dir\"; \ - done"' | tee /dev/stdout - @echo "Need more" + $(REMOTE_CMD) "bash -c '\ +cd $(RELEASES_DIR) && \ +echo \"[INFO] In directory: \$$PWD\" && \ +echo \"[INFO] Listing contents:\" && ls -1dt */ && \ +echo \"[INFO] Cleaning (dry-run):\" && \ +ls -1dt */ \ + | sed \"s:/*\\\$$::\" \ + | grep -v ^current\\\$$ \ + | grep -v ^$(TIMESTAMP)\\\$$ \ + | tail -n +4 \ + | xargs -r -I{} echo rm -rf \"{}\"'" ifeq ($(FORCE_DEPLOY), true) From b77483cf74ff57980b06c32d81c321cacecf3205 Mon Sep 17 00:00:00 2001 From: Niko Date: Sat, 21 Jun 2025 16:23:10 +0200 Subject: [PATCH 7/7] testing --- Makefile | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 966060181..98763ec06 100644 --- a/Makefile +++ b/Makefile @@ -57,17 +57,15 @@ preview: $(REMOTE_CMD) "cd $(RELEASES_DIR) && ln -snf $(TIMESTAMP) current" @echo "\n\n**** Preview complete.\n\n" @echo "Open the preview site at: $(PREVIEW_SITE_URL)\n\n" - @echo "\n**** Cleaning up old releases (keep latest 3, skip 'current')...\n" + @echo "\n**** Cleaning up old releases (keep latest 1, skip 'current')...\n" $(REMOTE_CMD) "bash -c '\ cd $(RELEASES_DIR) && \ -echo \"[INFO] In directory: \$$PWD\" && \ -echo \"[INFO] Listing contents:\" && ls -1dt */ && \ -echo \"[INFO] Cleaning (dry-run):\" && \ +echo \"[INFO] Cleaning:\" && \ ls -1dt */ \ | sed \"s:/*\\\$$::\" \ | grep -v ^current\\\$$ \ | grep -v ^$(TIMESTAMP)\\\$$ \ - | tail -n +4 \ + | tail -n +2 \ | xargs -r -I{} echo rm -rf \"{}\"'"