diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 76f896d..b3691ad 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -3,10 +3,12 @@ variables:
 
 stages:
   - build
+  - cleanup_build
   - deploy
-  - clean_after_deploy
+  - cleanup
 
-Npm, Bower, Grunt:
+build_job:
+  stage: build
   script:
     - npm install
     - $NPMPATH/bower install
@@ -14,7 +16,6 @@ Npm, Bower, Grunt:
   tags: 
   except:
     - tags
-  stage: build
   artifacts:
     paths:
       - dist/
@@ -23,6 +24,14 @@ Npm, Bower, Grunt:
       - index.html
       - manifest.appcache
 
+cleanup_build_job:
+  stage: cleanup_build
+  script:
+  - rm -r node_modules
+  - rm -r bower_components
+  - rm -r dist
+  when: on_failure
+
 staging:
   stage: deploy
   script: deploy.sh
@@ -41,12 +50,10 @@ production:
   variables:
     ENVIRON: production
 
-clean:
-  stage: clean_after_deploy
+cleanup_job:
+  stage: cleanup
   script:
   - rm -r node_modules
   - rm -r bower_components
   when: always
-
-
   
\ No newline at end of file