pipeline {
  agent any
  stages {
    stage ("build") {
      steps {
        nodejs("NodeJS (17.4.0)") {
          sh "npm install"
          sh "npm run build"
        }
      }
    }
    stage ("deploy") {
      when {
        branch '**/master'
      }
      steps {
        sshagent(['63d79efc-7b2b-43d6-87ad-90edebf74b1b']) {
          sh "scp -r dist/** www-data@sys.reslate.xyz:/var/www/ent.sys.reslate.xyz"
        }
      }
    }
  }
}