#  Template npm-publish

#  This template allows you to publish your npm package, as defined in package.json, to npmjs.com or any other npm-like registry.
#  The workflow allows running tests, code linting and security scans on feature branches (as well as master).
#  The npm package will be validated and published after the code is merged to master.

# Prerequisites: $NPM_TOKEN setup in the Deployment variables.
# For advanced cases, please, follow examples from the pipe's README https://bitbucket.org/atlassian/npm-publish/src/master/README.md

image: node:12

pipelines:
  default:
    - parallel:
      - step:
          name: Build and Test
          caches:
            - node
          script:
            - echo "Building 1... "
            - npm install
  branches:
    master:
      - parallel:
        - step:
            name: Build Assets
            caches:
              - node
            script:
              - echo "Building prod assets... "
              - npm install
              - npm run-script build:production
            artifacts:
              paths:
                - dist/**
      - step:
          name: Deploy to Staging
          deployment: staging
          script:
            - pipe: atlassian/rsync-deploy:0.7.1
              variables:
                USER: 'root'
                SERVER: '167.99.160.121'
                REMOTE_PATH: '/var/www/html/wp-content/themes/wereldhavendagen/'
                LOCAL_PATH: 'dist'
