diff --git a/jenkins/jenkinsfile b/jenkins/jenkinsfile index 0e12c26..57f92f2 100644 --- a/jenkins/jenkinsfile +++ b/jenkins/jenkinsfile @@ -1,15 +1,23 @@ -// Testing pipeline { agent any environment { - // Set the path where you want to copy the GitHub Pages contents + NGINX_IP = '172.18.0.3' + NGINX_PORT = '80' TARGET_FOLDER = '/mnt/user/appdata/nginx/www' - // Set the GitHub repository URL GITHUB_REPO_URL = 'https://github.com/fellrock/fellrock.github.io.git' } stages { + stage('Delete Existing Content on Nginx') { + steps { + script { + // Delete existing content on the Nginx server + sh "curl -X DELETE http://$NGINX_IP:$NGINX_PORT" + } + } + } + stage('Clone GitHub Pages') { steps { // Clone the GitHub Pages repository @@ -17,11 +25,11 @@ pipeline { } } - stage('Copy to Server') { + stage('Copy to Nginx Server') { steps { - // Copy the contents to the specified folder on the home server script { - sh "cp -R . $TARGET_FOLDER" + // Copy the contents to the specified folder on the Nginx server + sh "curl -X PUT --data-binary @. http://$NGINX_IP:$NGINX_PORT/$TARGET_FOLDER" } } } @@ -29,11 +37,9 @@ pipeline { post { success { - // Actions to be performed if the build is successful - echo 'GitHub Pages content copied successfully!' + echo 'Pipeline successfully executed!' } failure { - // Actions to be performed if the build fails echo 'Build failed. Please check the logs for details.' } }