variables: NPMPATH: "node_modules/.bin" stages: - build - cleanup_build - deploy - cleanup .run_deploy: &run_deploy script: - chmod +x ./deploy.sh - ./deploy.sh build_job: stage: build script: - npm install - $NPMPATH/bower install - $NPMPATH/grunt tags: except: - tags artifacts: paths: - dist/*.min.* - info/ - resources/ - index.html - manifest.appcache cleanup_build_job: stage: cleanup_build script: - rm -rf node_modules - rm -rf bower_components - rm -rf dist when: on_failure develop: stage: deploy <<: *run_deploy environment: develop except: - tags - master - develop variables: ENVIRON: develop TARGET: $WWW_DEPLOY_ROOT_DEVELOP staging: stage: deploy <<: *run_deploy environment: staging only: - develop variables: ENVIRON: staging TARGET: $WWW_DEPLOY_ROOT_STAGING production: stage: deploy <<: *run_deploy environment: production only: - master variables: ENVIRON: production TARGET: $WWW_DEPLOY_ROOT_PRODUCTION cleanup_job: stage: cleanup script: - rm -rf node_modules - rm -rf bower_components when: always