version: 2
jobs:
  test:
    docker:
      # use node:lts
      - image: cimg/node:lts
        environment:
           TZ: "Europe/London"
    working_directory: ~/repo
    steps:
      - checkout
      - run:
          name: install
          command: npm install
      - run:
          name: test
          command: npm test
      - run:
          name: codecov
          command: npm run coverage
  release:
    docker:
    # use node:lts
    - image: cimg/node:lts
      environment:
        TZ: "Europe/London"
    working_directory: ~/repo
    steps:
    - checkout
    - run:
        name: install
        command: npm install
    - run:
        name: release
        command: npx semantic-release
workflows:
  version: 2
  test_and_release:
    jobs:
    - test:
        context: tymly_global
    - release:
        context: tymly_global
        requires:
        - test
        filters:
          branches:
            only: master
