pipeline {
    agent any
    environment {
        DEPLOY_DIR = '/var/jenkins_home/deployments/personal-website'
    }
    stages {
        stage('Checkout') {
            steps {
                checkout scm
            }
        }
        stage('copy to nginx server') {
            steps {
                sh """
                    rm -rf ${DEPLOY_DIR}/*
                    cp -r * ${DEPLOY_DIR}/
                    chmod -R 755 ${DEPLOY_DIR}
                """
            }
        }
    }
    post {
        failure {
            echo "Build Failed"
        }
    }
}