From 427ea284c23c606a8c840127b50ccddd3d6d3ed7 Mon Sep 17 00:00:00 2001 From: Dandaedre Date: Thu, 3 Jul 2025 21:54:55 +0200 Subject: [PATCH] Add Jenkinsfile --- Jenkinsfile | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 Jenkinsfile diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..24219c3 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,58 @@ +pipeline { + agent { label 'rust_no_docker' } // any COULD work, but prefer this label for mdbooks + /* =============== + BEGIN USER CONFIG + ================== */ + + environment { + MDBOOK_BUILD_DIR = "book" // Don't change, it allows the build script & mdBook to know where the book is + DEPLOY_DIR = "/mnt/books/r6_guide" // Important, all books are in /mnt/book + } + + stages { + stage('Checkout') { + steps { + checkout scm // Checkout intead of full clone + } + } + + stage('Install mdBook') { + steps { + sh 'cargo install mdbook && echo "mdBook already installed"' // Install the latest mdBooks + } + } + + stage('Install plugins'){ + steps { + sh 'cargo install mdbook-admonish' // Change with desired plugins + } + } + + /* =============== + END USER CONFIG + ================== */ + + stage('Build Book') { + steps { + sh 'mdbook build' + } + } + + stage('Deploy to Books') { + steps { + sh 'echo "Deploying to ${DEPLOY_DIR}"' + sh 'mkdir -p ${DEPLOY_DIR}' + sh 'rsync -a --delete ${MDBOOK_BUILD_DIR}/ ${DEPLOY_DIR}' + } + } + } + + post { + success { + echo '✅ mdBook Built!' + } + failure { + echo '❌ mdbook Failed to Build' + } + } +}