Files
lpj/Jenkinsfile
Daeng Deni Mardaeni 9fcede4dc6 Refactor Jenkinsfile untuk optimasi pipeline
- Menambahkan variabel lingkungan DASHBOARD dan WORKDIR untuk penyederhanaan path.
- Menggunakan fungsi `dir` untuk memastikan konteks direktori kerja pada tahap 'Checkout' dan 'Build Assets'.
- Menghilangkan duplikasi perintah penggantian direktori manual.
2024-12-25 21:38:19 +07:00

43 lines
880 B
Groovy

pipeline {
agent any
environment {
PHP_VERSION = '8.1'
COMPOSER_HOME = "${WORKSPACE}/.composer"
DASHBOARD = '/var/www/lpj'
WORKDIR = '/var/www/lpj/Modules/Lpj'
}
stages {
stage('Checkout') {
steps {
dir("${env.WORKDIR}") {
sh "git checkout staging"
sh "git pull origin staging"
}
}
}
stage('Build Assets') {
steps {
dir("${env.WORKDIR}") {
sh "npm install"
sh "npm run build"
}
}
}
}
post {
always {
cleanWs()
}
success {
echo 'The pipeline has succeeded!'
}
failure {
echo 'The pipeline has failed.'
}
}
}