diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 420e13fe400909a4f64a39b0351622a01ea6c92d..c4bf29cefe00ab491fde220a75e2f762a4af77bc 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -19,13 +19,17 @@ pages:
         mike set-default --deploy-prefix public -r $HTTPS_REMOTE -p -b $PAGES_BRANCH latest
       elif [ "$CI_COMMIT_REF_NAME" == "develop" ]; then
         mike deploy --deploy-prefix public -r $HTTPS_REMOTE -p -b $PAGES_BRANCH -u $CI_COMMIT_BRANCH
+      elif [ -n "$CI_CLEAN" ]; then
+        rm -rf public/$CI_CLEAN
       fi
+
     - git checkout $PAGES_BRANCH -- public/
   artifacts:
     paths:
       - public/
   rules:
     - if: '$CI_COMMIT_TAG'
+    - if: '$CI_COMMIT_REF_NAME == "main"'
     - if: '$CI_COMMIT_REF_NAME == "develop"'
       when: always
     - when: never
\ No newline at end of file