defaults: &defaults working_directory: ~/tmp/windycoys docker: - image: circleci/node:10.15 semver-tags: &semver-tags filters: tags: only: /^v.*/ branches: ignore: /.*/ develop: &develop filters: branches: only: develop other-branches: &other-branches filters: branches: ignore: - master - develop version: 2 jobs: install: <<: *defaults steps: - attach_workspace: at: ~/tmp/windycoys - checkout - run: name: Install dependencies command: npm install - persist_to_workspace: root: . paths: . test: <<: *defaults steps: - attach_workspace: at: ~/tmp/windycoys - run: name: Run tests command: npm test build: <<: *defaults environment: NODE_ENV: production steps: - attach_workspace: at: ~/tmp/windycoys - run: name: Build CSS and JavaScript command: npm run build - run: name: Generate timestamp command: bash build/generate_timestamp.sh - persist_to_workspace: root: . paths: . deploy-prod: <<: *defaults steps: - attach_workspace: at: ~/tmp/windycoys - run: name: Install rsync command: sudo apt install -y rsync - run: name: Deploy theme command: bash build/deploy.sh prod - run: name: Purge Cloudflare cache command: bash build/purge_cache.sh deploy-develop: <<: *defaults steps: - attach_workspace: at: ~/tmp/windycoys - run: name: Install rsync command: sudo apt install -y rsync - run: name: Deploy theme command: bash build/deploy.sh develop - run: name: Purge Cloudflare cache command: bash build/purge_cache.sh workflows: version: 2 test: jobs: - install: *other-branches - test: <<: *other-branches requires: - install develop: jobs: - install: *develop - test: <<: *develop requires: - install - build: <<: *develop requires: - test - deploy-develop: <<: *develop requires: - build prod: jobs: - install: *semver-tags - test: <<: *semver-tags requires: - install - build: <<: *semver-tags requires: - test - deploy-prod: <<: *semver-tags requires: - build