From cea6d218f8779f0c3e9ec2ec9cbe4d0207dc857f Mon Sep 17 00:00:00 2001 From: Bangara Raju Kottedi Date: Mon, 16 Feb 2026 17:40:09 +0530 Subject: [PATCH] feat: add Jenkins pipeline for automated deployment --- Jenkinsfile | 69 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 Jenkinsfile diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..00a7411 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,69 @@ +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!" + } + } +}