From 1f213f47e898e1e4de5eb75708c121755551dbcb Mon Sep 17 00:00:00 2001 From: Emilia Date: Tue, 30 Jan 2024 20:49:27 -0500 Subject: [PATCH] Jenkinsfile compatability with main --- Jenkinsfile | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 971ea8a..0bff50a 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -2,11 +2,22 @@ pipeline { agent any stages { + stage('Setup') { + if (env.BRANCH_NAME == 'main') { + environment { + OUTPUT_DIR = 'plate-tool' + } + } else { + environment { + OUTPUT_DIR = 'plate-tool-beta' + } + } + } stage('Build') { steps { sh ''' . "$HOME/.cargo/env" - trunk build --release --public-url "cool-stuff/plate-tool-beta/" + trunk build --release --public-url "cool-stuff/$OUTPUT_DIR/" ''' } } @@ -24,7 +35,7 @@ pipeline { stage('Deploy') { steps { sh ''' - ssh oracle "sudo rm -rf /usr/share/nginx/html/plate-tool-beta/ && sudo mv dist /usr/share/nginx/html/plate-tool-beta" + ssh oracle "sudo rm -rf /usr/share/nginx/html/$OUTPUT_DIR/ && sudo mv dist /usr/share/nginx/html/$OUTPUT_DIR" ''' } }