feat: 更新 Jenkinsfile,添加清理工作区和打包步骤
This commit is contained in:
1 parent
8a6d0b210c
commit
c9f9255e5e
1 file changed
+32
Vendored
+32
@@ -8,18 +8,27 @@ pipeline {
|
||||
options {
|
||||
timestamps()
|
||||
disableConcurrentBuilds()
|
||||
|
||||
buildDiscarder(
|
||||
logRotator(
|
||||
numToKeepStr: '10',
|
||||
artifactNumToKeepStr: '5'
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
stages {
|
||||
|
||||
stage('Checkout') {
|
||||
steps {
|
||||
cleanWs()
|
||||
checkout scm
|
||||
}
|
||||
}
|
||||
|
||||
stage('Install') {
|
||||
steps {
|
||||
// Install frontend dependencies
|
||||
dir('dashboard') {
|
||||
sh 'npm ci'
|
||||
}
|
||||
@@ -28,11 +37,34 @@ pipeline {
|
||||
|
||||
stage('Build') {
|
||||
steps {
|
||||
// Build frontend
|
||||
dir('dashboard') {
|
||||
sh 'npm run build'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage('Package') {
|
||||
steps {
|
||||
// Package frontend
|
||||
sh 'zip -r dashboard.zip dashboard/dist'
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
post {
|
||||
success {
|
||||
archiveArtifacts artifacts: 'dashboard.zip', fingerprint: true
|
||||
echo 'Build succeeded'
|
||||
}
|
||||
|
||||
failure {
|
||||
echo 'Build failed'
|
||||
}
|
||||
|
||||
always {
|
||||
echo 'Pipeline finished'
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user