image: node:12.16.1

pipelines:
  branches:
    staging:
        - step:
            name: Build
            caches:
              - node
            script:
              - mv .env.sample .env
              - npm install
              - npm run build
            artifacts:
              - .nuxt/**
        - step:
            name: Deploy to Staging
            deployment: staging
            script:
              - pipe: atlassian/scp-deploy:0.3.3
                variables:
                  USER: $USER
                  SERVER: $SERVER
                  REMOTE_PATH: '/var/www-staging/ewemove-franchisee.nzi.me'
                  LOCAL_PATH: '.nuxt .npmrc static middleware 301.json package.json package-lock.json nuxt.config.js'
              # - pipe: atlassian/ssh-run:0.2.5
              #   variables:
              #     SSH_USER: $USER
              #     SERVER: $SERVER
              #     COMMAND: 'pm2 restart "TPFG"'