You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

52 lines
1.5 KiB
Groovy

pipeline {
agent any
// environment {
// NODEJS_HOME = '/usr/local/nodejs' // Adjust this path to your Node.js installation
// PATH = "${NODEJS_HOME}/bin:${env.PATH}"
// }
stages {
stage('📄文件信息') {
steps {
sh 'pwd'
sh 'ls -al'
}
}
stage('🛠️构建项目') {
steps {
withDockerContainer('node:18-alpine') {
sh 'npm -v'
sh 'npm config set registry https://registry.npmmirror.com'
sh 'npm install'
sh 'npm run build'
sh 'ls -al'
}
}
}
stage('🎁打包制品'){
steps {
dir('dist') {
sh 'ls -al'
sh 'tar -zcvf gofishingweb.tar.gz *'
archiveArtifacts artifacts: 'gofishingweb.tar.gz',
allowEmptyArchive: true,
fingerprint: true,
onlyIfSuccessful: true
sh 'ls -al'
}
}
}
}
post {
success {
echo 'Deployment successful!'
}
failure {
echo 'Deployment failed.'
}
}
}