Skip to content

Commit

Permalink
update jenkins file
Browse files Browse the repository at this point in the history
  • Loading branch information
fellrock committed Mar 5, 2024
1 parent dcc7597 commit 0f76a41
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions jenkins/jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,39 +1,45 @@
// 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
checkout([$class: 'GitSCM', branches: [[name: '*/master']], userRemoteConfigs: [[url: GITHUB_REPO_URL]]])
}
}

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"
}
}
}
}

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.'
}
}
Expand Down

0 comments on commit 0f76a41

Please sign in to comment.