diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index ab770758ff0f2ad71b786a359e56cd7e7b52f41d..bd2016ee4a7426ab193febbdd40363604631f452 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -76,25 +76,23 @@ build-testenv:
     - docker push $CI_REGISTRY_IMAGE
 
 # Build the sphinx documentation and make it ready for deployment by Gitlab Pages
-# documentation:
-#   stage: deploy
-
 # Special job for serving a static website. See https://docs.gitlab.com/ee/ci/yaml/README.html#pages
-pages:
-  tags: [ docker ]
+pages_prepare: &pages_prepare
+  tags: [ cached-dind ]
   stage: deploy
   only:
     refs:
       - /^release-.*$/i
-      - master
-    variables:
-      # run pages only on gitlab.com
-      - $CI_SERVER_HOST == "gitlab.com"
   script:
     - echo "Deploying"
-    - cat doc/index.rst
     - make doc
     - cp -r build/doc/html public
   artifacts:
     paths:
       - public
+pages:
+  <<: *pages_prepare
+  only:
+    refs:
+      - main
+