diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 813ce814ac61e1914b295abc1a25b323180f3b40..2cdedb67199cc20ffeb8fad04099fa3d63ec4289 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -21,7 +21,7 @@ variables:
   - 'if fgrep Axiom build-log.txt >/dev/null; then exit 1; fi'
   - 'cat build-log.txt | egrep "[a-zA-Z0-9_/-]+ \((real|user): [0-9]" | tee build-time.txt'
   # maybe generate and upload doc (has to be in this job as we need coq installed)
-  - 'if [[ -n "$DOCDIR" ]]; then build/coqdoc; fi'
+  - 'if [[ -n "$DOCDIR" && "$CI_COMMIT_REF_NAME" == master ]]; then build/coqdoc; fi'
   cache:
     key: "$CI_JOB_NAME"
     paths: