| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- pipeline {
- agent any
- tools {
- nodejs "NodeJS24.7.0" // Name same as in Global Tool Config
- }
- triggers {
- // poll SCM every 2 minutes
- pollSCM('* * * * *')
- }
- 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()
- }
- }
- }
|