pipelines:

  default:
    - parallel:
      - step:
          name: 'Node 16: Install and Test'
          image: node:16
          script:
            - npm install
            - npm run test
      - step:
          name: 'Node 18: Install and Test'
          image: node:18
          script:
            - npm install
            - npm run test
      - step:
          name: 'Node 20: Install and Test'
          image: node:20
          script:
            - npm install
            - npm run test

  tags:
    patch:
      - step:
          name: 'Publish patch'
          image: node:20
          script:
            - npm ci
            - npm version -m "%s [skip ci]" patch
            - git push origin HEAD:main
            - git push --tags
            - git push origin --delete patch
    minor:
      - step:
          name: 'Publish minor'
          image: node:20
          script:
            - npm ci
            - npm version -m "%s [skip ci]" minor
            - git push origin HEAD:main
            - git push --tags
            - git push origin --delete minor
    major:
      - step:
          name: 'Publish major'
          image: node:20
          script:
            - npm ci
            - npm version -m "%s [skip ci]" major
            - git push origin HEAD:main
            - git push --tags
            - git push origin --delete major
