version: 2
jobs:
  build:
    docker:
      # https://circleci.com/docs/2.0/circleci-images/#nodejs
      - image: circleci/node:latest

    working_directory: ~/ofreport.com

    environment:
      NUXT_BUILD_DIR: ~/ofreport.com/dist
      PER_PAGE: "10"
      APP_ENV: "prod"

    steps:
      - checkout

      # Download and cache dependencies
      - restore_cache:
          keys:
            - v1-dependencies-{{ checksum "package.json" }}
            # fallback to using the latest cache if no exact match is found
            - v1-dependencies-

      - run: yarn install

      - save_cache:
          paths:
            - node_modules
          key: v1-dependencies-{{ checksum "package.json" }}

      - run: yarn md2json
      - run: yarn generate

  deploy:
    docker:
      # https://circleci.com/docs/2.0/circleci-images/#nodejs
      - image: circleci/node:latest

    working_directory: ~/ofreport.com

    steps:
      - run:
          name: Install Gulp
          command: sudo npm install -g gulp
      - run:
          name: Deploy to S3
          command: gulp deploy

workflows:
  version: 2
  build-deploy:
    jobs:
      - build
      - deploy:
          requires:
            - build
          filters:
            branches:
              only: master

version: 2
jobs:
  build:
    docker:
      # https://circleci.com/docs/2.0/circleci-images/#nodejs
      - image: circleci/node:latest

    working_directory: ~/ofreport.com

    environment:
      NUXT_BUILD_DIR: ~/ofreport.com/dist
      PER_PAGE: "10"
      APP_ENV: "prod"

    steps:
      - checkout

      # Download and cache dependencies
      - restore_cache:
          keys:
            - v1-dependencies-{{ checksum "package.json" }}
            # fallback to using the latest cache if no exact match is found
            - v1-dependencies-

      - run: yarn install

      - save_cache:
          paths:
            - node_modules
          key: v1-dependencies-{{ checksum "package.json" }}

      - run: yarn md2json
      - run: yarn generate

  deploy:
    docker:
      # https://circleci.com/docs/2.0/circleci-images/#nodejs
      - image: circleci/node:latest

    working_directory: ~/ofreport.com

    steps:
      - run:
          name: Install Gulp
          command: sudo npm install -g gulp
      - run:
          name: Deploy to S3
          command: gulp deploy

workflows:
  version: 2
  build-deploy:
    jobs:
      - build
      - deploy:
          requires:
            - build
          # filters:
          #   branches:
          #     only: master

Comment out master filter for now.
Comment out master filter for now.
