# CONFIG GENERATED BY DOTCOM-TOOL-KIT, DO NOT EDIT BY HAND
version: 2.1
orbs:
  tool-kit: financial-times/dotcom-tool-kit@5
executors:
  node:
    docker:
      - image: cimg/node:20.17.0
jobs:
  checkout:
    docker:
      - image: cimg/base:stable
    steps:
      - checkout
      - tool-kit/persist-workspace:
          path: .
workflows:
  tool-kit:
    when: |
      pipeline.trigger_source != "scheduled_pipeline" and
      (pipeline.event.name == "push" or (pipeline.event.name == "pull_request"
      and pipeline.event.action != "closed"))
    jobs:
      - checkout:
          filters:
            tags:
              only: /^v\d+\.\d+\.\d+(-.+)?/
      - tool-kit/setup:
          executor: node
          requires:
            - checkout
          filters:
            tags:
              only: /^v\d+\.\d+\.\d+(-.+)?/
      - tool-kit/build:
          executor: node
          requires:
            - tool-kit/setup
          filters:
            tags:
              only: /^v\d+\.\d+\.\d+(-.+)?/
      - tool-kit/test:
          executor: node
          requires:
            - tool-kit/build
          filters:
            tags:
              only: /^v\d+\.\d+\.\d+(-.+)?/
      - tool-kit/publish-tag:
          executor: node
          requires:
            - tool-kit/test
          filters:
            tags:
              only: /^v\d+\.\d+\.\d+(-.+)?/
            branches:
              ignore: /.*/
          context: npm-publish-token
  nightly:
    when:
      and:
        - equal:
            - scheduled_pipeline
            - << pipeline.trigger_source >>
        - equal:
            - nightly
            - << pipeline.schedule.name >>
    jobs:
      - checkout
      - tool-kit/setup:
          executor: node
          requires:
            - checkout
      - tool-kit/build:
          executor: node
          requires:
            - tool-kit/setup
      - tool-kit/test:
          executor: node
          requires:
            - tool-kit/build
  pr-close:
    jobs:
      - checkout:
          requires: []
      - tool-kit/setup:
          executor: node
          requires:
            - checkout
    when: >
      pipeline.trigger_source != "scheduled_pipeline" and

      (pipeline.event.name == "pull_request" and pipeline.event.action ==
      "closed")
