image: node:18.19.0

pipelines:
  branches:
    main:
      - parallel:
          - step:
              name: Build and Test
              caches:
                - node
              script:
                - npm install --legacy-peer-deps
          - step:
              name: Security Scan
              script:
                - pipe: atlassian/git-secrets-scan:0.5.1
      - step:
          name: Deploy
          size: 2x
          deployment: Production
          script:
            - export NODE_OPTIONS=--max_old_space_size=8192
            - npm --no-git-tag-version version "1.5.$BITBUCKET_BUILD_NUMBER" -m "Upgrade to new version"
            - echo $VERSION
            - npm install --legacy-peer-deps
            - npm run build
            - pipe: atlassian/npm-publish:0.3.2
              variables:
                NPM_TOKEN: $NPM_TOKEN
                EXTRA_ARGS: '--access public'
            - git tag -a "1.5.$BITBUCKET_BUILD_NUMBER" -m "Version 1.5.$BITBUCKET_BUILD_NUMBER"
            - git push origin "1.5.$BITBUCKET_BUILD_NUMBER"
