diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 276c6327520632af03bd645579aa0f31a08e20e4..0a3103c18054f844b2d4640365ed1757bc2c7971 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -6,12 +6,26 @@ variables:
   DOCKER_HOST: tcp://docker:2375
   DOCKER_DRIVER: overlay2
 
+stages:
+  - test
+  - publish
+
 
 before_script:
     - apk --no-cache add python git
 
+test:
+    stage: test
+    script:
+        - git diff-tree --no-commit-id --name-only -r HEAD
+        - python publish_images.py -q
+    tags:
+        - docker
+    except:
+        - master
 
-build:
+publish:
+    stage: publish
     script:
         - git diff-tree --no-commit-id --name-only -r HEAD
         - python publish_images.py