journal.pl/Jenkinsfile

58 lines
1.7 KiB
Plaintext
Raw Normal View History

2024-03-29 11:39:32 +03:00
pipeline {
2024-08-07 23:22:10 +03:00
agent {
docker {
image 'node:20'
}
2024-03-29 10:40:00 +03:00
}
2024-08-07 23:22:10 +03:00
stages {
stage('install') {
steps {
sh 'node -v'
sh 'npm -v'
script {
String tag = sh(returnStdout: true, script: 'git tag --contains').trim()
String branchName = sh(returnStdout: true, script: 'git rev-parse --abbrev-ref HEAD').trim()
String commit = sh(returnStdout: true, script: 'git log -1 --oneline').trim()
String commitMsg = commit.substring(commit.indexOf(' ')).trim()
2024-03-29 10:40:00 +03:00
2024-08-07 23:22:10 +03:00
if (tag) {
currentBuild.displayName = "#${BUILD_NUMBER}, tag ${tag}"
} else {
currentBuild.displayName = "#${BUILD_NUMBER}, branch ${branchName}"
}
2024-03-29 10:40:00 +03:00
2024-08-07 23:22:10 +03:00
String author = sh(returnStdout: true, script: "git log -1 --pretty=format:'%an'").trim()
currentBuild.description = "${author}<br />${commitMsg}"
echo 'starting installing'
sh 'npm ci'
}
}
}
stage('checks') {
parallel {
stage('eslint') {
steps {
sh 'npm run eslint'
}
}
stage('build') {
steps {
sh 'npm run build'
}
}
}
}
2024-03-29 13:29:35 +03:00
2024-08-07 23:22:10 +03:00
stage('clean-all') {
steps {
sh 'rm -rf .[!.]*'
sh 'rm -rf ./*'
sh 'ls -a'
}
}
2024-03-29 13:29:35 +03:00
}
2024-03-29 11:39:32 +03:00
}