diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 7e1d85ac7b79b5772e6e51fd589b81b430a13673..39bd777603e82c4bb98f8c87a7878d8a100c949f 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -54,6 +54,28 @@ do-not-stop-pipeline:
     variables:
       - $DEFAULT == $CI_COMMIT_BRANCH
 
+check-publish:
+  stage: prepare
+  script: >
+    [[ "$RELEASE" == "no" ]] &&
+    [[ "$DEFAULT" == "$CI_COMMIT_BRANCH" ]] &&
+    [[ "$DEFAULT" == "master" ]]
+  only:
+    variables:
+      - $PUBLISH == "yes"
+
+check-release:
+  stage: prepare
+  script: >
+    [[ "$PUBLISH" == "no" ]] &&
+    [[ "$DEFAULT" == "$CI_COMMIT_BRANCH" ]] &&
+    [[ "$DEFAULT" == "stable/$(cat VERSION_CODENAME | tr '[:upper:]' '[:lower:]')" ]] &&
+    [[ "$(git describe --tag)" == "$(cat VERSION | sed 's/~/-/')" ]]
+    [[ "$(cat VERSION)" == "$(cat opam/opam | grep "^version" | sed 's/version: \"\(.*\)\"/\1/')" ]]
+  only:
+    variables:
+      - $RELEASE == "yes"
+
 ################################################################################
 ### BUILD