Jenkins update

This commit is contained in:
2025-01-18 22:10:04 +03:00
parent d77f1ca615
commit b20ee8db45

20
Jenkinsfile vendored
View File

@@ -1,6 +1,6 @@
pipeline { pipeline {
agent any agent any
environment { environment {
BUILD_TIMESTAMP = new java.text.SimpleDateFormat('yyyy-MM-dd HH:mm:ss').format(new java.util.Date()) BUILD_TIMESTAMP = new java.text.SimpleDateFormat('yyyy-MM-dd HH:mm:ss').format(new java.util.Date())
} }
@@ -29,7 +29,25 @@ pipeline {
sh 'ls -la' sh 'ls -la'
} }
} }
stage('Check for package.json changes') {
steps {
script {
// Check if package.json has changed
def hasChanges = sh(script: 'git diff --name-only HEAD~1 | grep "package.json"', returnStatus: true) == 0
if (hasChanges) {
echo "package.json changed, running npm install"
currentBuild.result = 'SUCCESS'
} else {
echo "package.json not changed, skipping npm install"
currentBuild.result = 'SUCCESS'
}
}
}
}
stage('Install Dependencies') { stage('Install Dependencies') {
when {
expression { currentBuild.result == 'SUCCESS' }
}
steps { steps {
sh 'npm install' sh 'npm install'
} }