diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 73d57347392e841021bbcb274c531049385eca2b..5b0516334dda1fd82be60970eec4235344a861b9 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -8,9 +8,10 @@ stages:
   tags:
     - docker
   rules:
-    - if: '$CI_COMMIT_BRANCH == "master"'
+    - if: '$CI_COMMIT_REF_NAME == "master"'
       changes:
         - gms-client/gms-client/*
+        - .gitlab-ci.yml
 
 build_gms_client:
   extends: .gms_client
@@ -42,9 +43,10 @@ test_gms:
     - awk -F"," '{ instructions += $4 + $5; covered += $5 } END { print "coverage=" 100*covered/instructions }' target/site/jacoco/jacoco.csv
   coverage: '/coverage=\d+\.\d+/'
   rules:
-    - if: '$CI_COMMIT_BRANCH == "master"'
+    - if: '$CI_COMMIT_REF_NAME == "master"'
       changes:
         - gms/*
+        - .gitlab-ci.yml
 
 deploy_gms_client:
   extends: .gms_client
@@ -74,9 +76,10 @@ deploy_gms_lib:
         -Durl=${IA2_MVN_REPO_SNAPSHOTS}
         -DpomFile=pom.xml
   rules:
-    - if: '$CI_COMMIT_BRANCH == "master"'
+    - if: '$CI_COMMIT_REF_NAME == "master"'
       changes:
         - gms/*
+        - .gitlab-ci.yml
 
 dockerize_db:
   stage: deploy
@@ -87,10 +90,11 @@ dockerize_db:
     - docker build -t "${CI_REGISTRY_IMAGE}/database" -f database/Dockerfile .
     - docker push "${CI_REGISTRY_IMAGE}/database"
   rules:
-    - if: '$CI_COMMIT_BRANCH == "master"'
+    - if: '$CI_COMMIT_REF_NAME == "master"'
       changes:
         - database/*
         - gms/src/main/resources/sql/*
+        - .gitlab-ci.yml
 
 dockerize_gms:
   stage: deploy
@@ -101,10 +105,11 @@ dockerize_gms:
     - docker build -t "${CI_REGISTRY_IMAGE}" -f gms/Dockerfile .
     - docker push "${CI_REGISTRY_IMAGE}"
   rules:
-    - if: '$CI_COMMIT_BRANCH == "master"'
+    - if: '$CI_COMMIT_REF_NAME == "master"'
       changes:
         - gms/*
         - gms-ui/*
+        - .gitlab-ci.yml
 
 upload_jar:
   stage: publish