farmcontrol-server/Jenkinsfile
2025-06-01 21:39:47 +01:00

64 lines
1.6 KiB
Groovy

pipeline {
agent any
environment {
NODE_ENV = 'production'
}
stages {
stage('Setup Node.js') {
steps {
nodejs(nodeJSInstallationName: 'Node23') {
sh 'node -v'
sh 'npm -v'
}
}
}
stage('Install Dependencies') {
steps {
nodejs(nodeJSInstallationName: 'Node23') {
sh 'npm ci --include=dev'
}
}
}
stage('Build') {
steps {
nodejs(nodeJSInstallationName: 'Node23') {
sh 'npm run build'
}
}
}
stage('Deploy to printer1') {
steps {
script {
def remote = [:]
remote.name = 'printer1'
remote.host = 'printer1.tombutcher.local'
remote.user = 'ci'
remote.password = 'ci'
remote.allowAnyHosts = true
// Upload the build folder
sshPut remote: remote, from: 'build/', into: '/srv/farmcontrol-server/', flatten: false
// Restart the service
sshCommand remote: remote, command: 'sudo /bin/systemctl restart farmcontrol-server.service'
}
}
}
}
post {
always {
cleanWs()
}
success {
echo 'Pipeline completed successfully!'
}
failure {
echo 'Pipeline failed!'
}
}
}