pipeline { agent any tools { nodejs "NodeJS24.7.0" // Name same as in Global Tool Config } triggers { // poll SCM every 2 minutes pollSCM('H/2 * * * *') } stages { stage('Checkout') { steps { echo "๐Ÿ“ฅ Pulling code from Gogs..." git branch: 'master', url: 'https://scm.finlabsindia.org/samruddhi/Test_Repo_React_Project.git', credentialsId: 'gogs-pat-for-react-app' // Jenkins credential ID for PAT } } stage('Install Dependencies') { steps { echo "๐Ÿ“ฆ Installing dependencies..." sh 'npm install' } } stage('Build') { steps { echo "๐Ÿ—๏ธ Building React app..." sh 'npm run build' } } stage('Deploy') { steps { echo "๐Ÿš€ Deploying React app..." // Dummy command for testing sh 'echo "Simulating deploy step: copying build/ to web server path"' // ๐Ÿ”ฅ Real deploy example: // sh 'cp -r build/* /var/www/html/' } } } post { always { echo "๐Ÿงน Cleaning workspace..." cleanWs() } } }