diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index cb64c0d27c964228ceda3ef8e1381aa0c3f6dd11..e40be400f70110767b6eb2d9f2d5fa8ce6fa5518 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -40,7 +40,7 @@ test:
 #      when: never
     - if: '$CI_COMMIT_BRANCH'
 
-# generate documentation when commiting to master
+# generate documentation when commiting to master and the VERSION.txt file has changed
 document:
   stage: document
   script:
@@ -49,6 +49,8 @@ document:
     - shared-fi
   rules:
     - if: '$CI_COMMIT_BRANCH == "master"'
+      changes:
+        - VERSION.txt
     - if: '$CI_COMMIT_BRANCH'
       when: never
   artifacts: