46 lines
872 B
Groovy
46 lines
872 B
Groovy
pipeline {
|
|
agent any
|
|
|
|
environment {
|
|
NODE_VERSION = '20.17.0'
|
|
}
|
|
|
|
stages {
|
|
stage('Checkout Repository') {
|
|
steps {
|
|
checkout scm
|
|
}
|
|
}
|
|
|
|
stage('Setup Node.js') {
|
|
steps {
|
|
script {
|
|
sh "curl -fsSL https://deb.nodesource.com/setup_${NODE_VERSION}.x | bash -"
|
|
sh "sudo apt-get install -y nodejs"
|
|
}
|
|
}
|
|
}
|
|
|
|
stage('Install Dependencies') {
|
|
steps {
|
|
sh 'npm ci'
|
|
}
|
|
}
|
|
|
|
stage('Build Project') {
|
|
steps {
|
|
sh 'npm run build'
|
|
}
|
|
}
|
|
}
|
|
|
|
post {
|
|
success {
|
|
echo 'Build completed successfully!'
|
|
}
|
|
failure {
|
|
echo 'Build failed!'
|
|
}
|
|
}
|
|
}
|