version: 2.1

orbs:
  plugin-ci: mattermost/plugin-ci@volatile

workflows:
  version: 2
  ci:
    jobs:
      - plugin-ci/lint:
          filters:
            tags:
              only: /^v.*/
      - plugin-ci/coverage:
          filters:
            tags:
              only: /^v.*/
      - plugin-ci/build:
          filters:
            tags:
              only: /^v.*/
      - plugin-ci/deploy-ci:
          filters:
            branches:
              only: master
          context: plugin-ci
          requires:
            - plugin-ci/lint
            - plugin-ci/coverage
            - plugin-ci/build
      - plugin-ci/deploy-release:
          filters:
            tags:
              only: /^v.*/
            branches:
              ignore: /.*/
          context: plugin-ci
          requires:
            - plugin-ci/lint
            - plugin-ci/coverage
            - plugin-ci/build
      - plugin-ci/deploy-release-github:
          filters:
            tags:
              only: /^v.*/
            branches:
              ignore: /.*/
          context: matterbuild-github-token
          requires:
            - plugin-ci/lint
            - plugin-ci/coverage
            - plugin-ci/build
