# Anchor for the standard staging build & deploy script
x-staging-script: &staging_script
  - echo "Installing dependencies with npm ci..."
  - unset CI
  - npm i --legacy-peer-deps
  - export NODE_OPTIONS=--max-old-space-size=6144
  - echo "Building React website..."
  - npm run build
  - pipe: atlassian/scp-deploy:1.1.0
    variables:
      USER: ${SCP_USER}
      SERVER: ${SCP_SERVER}
      REMOTE_PATH: '/var/www/html/artur.com'
      LOCAL_PATH: 'build/**'
      DEBUG: 'true'

image: node:18

definitions:
  caches:
    node: node_modules

pipelines:
  branches:
    dev:
      - step:
          name: DEV Build and Deploy
          size: 2x
          deployment: staging
          caches:
            - node
          # Correct usage: The alias replaces the entire 'script' list.
          script: *staging_script