portfolio-admin/Jenkinsfile
Bangara Raju Kottedi cea6d218f8
Some checks failed
bangararaju.kottedi.in/admin/admin-uat-new/pipeline/head There was a failure building this commit
feat: add Jenkins pipeline for automated deployment
2026-02-16 17:40:09 +05:30

70 lines
1.6 KiB
Groovy

pipeline {
agent { label 'built-in' }
options {
buildDiscarder(logRotator(numToKeepStr: '10'))
}
environment {
DEPLOY_PATH = "/var/www/bangararaju.kottedi.in/admin"
}
stages {
stage('Checkout') {
steps {
checkout scm
}
}
stage('Inject Environment File') {
steps {
configFileProvider(
[configFile(fileId: 'admin-uat-properties',
targetLocation: 'src/environments/environment.ts',
replaceTokens: true)]
) {
echo "Environment file injected"
}
}
}
stage('Build Angular') {
steps {
sh '''
rm -rf $DEPLOY_PATH/*
ng build --configuration production --base-href /admin/
'''
}
}
stage('Deploy') {
steps {
sh '''
cp -r dist/portfolio-admin/browser/* $DEPLOY_PATH/
chown -R www-data:www-data $DEPLOY_PATH
systemctl reload nginx
'''
}
}
stage('Health Check') {
steps {
sh '''
sleep 2
curl -f https://bangararaju-uat.kottedi.in/admin
'''
}
}
}
post {
failure {
echo "Deployment failed!"
}
success {
echo "Deployment successful!"
}
}
}