image: node:16

pipelines:
  branches:
    dev: 
      - step:
          name: Deploy Source to Server (dev) & Build 
          script:
            - echo "Deploying fabqoute-contractor-dev to dev environment..."  
            - ssh $USER@$SERVER '
                cd /var/www/fabqoute-contractor-dev.sandbox-dev.co.uk && 
                git pull origin dev &&
                npm install --force && 
                npm run build && 
                pm2 restart fabqoute-contractor-dev-9007

              '
            - echo "dev Deployment completed successfully!"

    uat: 
      - step:
          name: Deploy Source to Server (uat) & Build 
          script:
            - echo "Deploying fabqoute-contractor-uat to uat environment..."  
            - ssh $USER@$SERVER '
                cd /var/www/fabqoute-contractor-uat.sandbox-dev.co.uk && 
                git pull origin uat &&
                npm install --force && 
                npm run build && 
                pm2 restart fabqoute-contractor-uat-9008

              '
            - echo "uat Deployment completed successfully!"
