clone:
  depth: full
options:
  docker: true
  size: 2x
pipelines:
  branches: #these will run on every push of the branch
    staging:
      - step:
          name: Publish to staging
          image: node:14.17.0
          deployment: staging
          script:
            - npm run publish-staging
            - pipe: atlassian/slack-notify:2.0.0
              variables:
                WEBHOOK_URL: 'https://hooks.slack.com/services/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'
                # PRETEXT: 'Staging version'
                MESSAGE: 'New staging version for *stuff-ui* released.      New version: *$(npm view stuff-ui@staging version)*      @here'
    master:
      - step:
          name: Publish to production
          image: node:14.17.0
          deployment: production
          script:
            - npm run publish-production
            - pipe: atlassian/slack-notify:2.0.0
              variables:
                WEBHOOK_URL: 'https://hooks.slack.com/services/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'
                # PRETEXT: 'Production version'
                MESSAGE: 'New production version for *stuff-ui* released.      New version: *$(npm view stuff-ui@latest version)*      @here'
      - step:
          name: SonarQube analysis
          image: maven:3.3.9
          script:
            - pipe: sonarsource/sonarqube-scan:1.0.0
              variables:
                SONAR_HOST_URL: ${SONAR_HOST_URL} # Get the value from the repository/workspace variable.
                SONAR_TOKEN: ${SONAR_TOKEN} # Get the value from the repository/workspace variable. You shouldn't set secret in clear text here.
definitions:
  caches:
    sonar: ~/.sonar
  services:
    docker:
      memory: 4096