version: 2.1

orbs:
  hokusai: artsy/hokusai@0.3.0

jobs:
  build-and-test:
    docker:
      - image: artsy/hokusai
    steps:
      - add_ssh_keys
      - checkout
      - setup_remote_docker
      - run:
          name: Test
          command: COMMIT_HASH_FULL=$(git rev-parse HEAD) CODECOV_TOKEN=$CODECOV_TOKEN BRANCH_NAME=$CIRCLE_BRANCH hokusai test --build

not_staging_or_release: &not_staging_or_release
  filters:
    branches:
      ignore:
        - staging
        - release

only_master: &only_master
  context: hokusai
  filters:
    branches:
      only: master

only_release: &only_release
  context: hokusai
  filters:
    branches:
      only: release

workflows:
  build-deploy:
    jobs:
      - build-and-test:
          <<: *not_staging_or_release

      # Staging
      - hokusai/push:
          name: push-staging-image
          <<: *only_master
          requires:
            - build-and-test

      - hokusai/deploy-staging:
          <<: *only_master
          project-name: positron
          requires:
            - push-staging-image

      # Release
      - hokusai/push:
          name: push-production-image
          <<: *only_release
      - hokusai/deploy-production:
          <<: *only_release
          requires:
            - push-production-image

version: 2.1

orbs:
  hokusai: artsy/hokusai@0.4.0

jobs:
  build-and-test:
    docker:
      - image: artsy/hokusai
    steps:
      - add_ssh_keys
      - checkout
      - setup_remote_docker
      - run:
          name: Test
          command: COMMIT_HASH_FULL=$(git rev-parse HEAD) CODECOV_TOKEN=$CODECOV_TOKEN BRANCH_NAME=$CIRCLE_BRANCH hokusai test --build

not_staging_or_release: &not_staging_or_release
  filters:
    branches:
      ignore:
        - staging
        - release

only_master: &only_master
  context: hokusai
  filters:
    branches:
      only: master

only_release: &only_release
  context: hokusai
  filters:
    branches:
      only: release

workflows:
  build-deploy:
    jobs:
      - build-and-test:
          <<: *not_staging_or_release

      # Staging
      - hokusai/push:
          name: push-staging-image
          <<: *only_master
          requires:
            - build-and-test

      - hokusai/deploy-staging:
          <<: *only_master
          project-name: positron
          requires:
            - push-staging-image

      # Release
      - hokusai/push:
          name: push-production-image
          <<: *only_release
      - hokusai/deploy-production:
          <<: *only_release
          requires:
            - push-production-image

Update hokusai orb to v0.4.0
Update hokusai orb to v0.4.0
