From aadb5d931ba59aec98d3b17fa0824a9ef6bd3152 Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Wed, 26 Apr 2023 12:02:26 +0200 Subject: [PATCH] also build web if not publishing --- Jenkinsfile | 47 +++++++++++++++++++++++++++++------------------ 1 file changed, 29 insertions(+), 18 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 86fdbb3..710fac3 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,26 +1,37 @@ pipeline { - agent { label 'web' } + agent none stages { - stage('Site') { - when { - branch 'main' - } - steps { - sh '''cd web - bundle - bundle exec jekyll build''' - sh 'rm -rf /var/www/tinylifegame/*' - sh 'cp -r web/_site/. /var/www/tinylifegame/' + stage('Build') { + agent any + stages { + stage('Site') { + steps { + sh '''cd web + bundle + bundle exec jekyll build''' + stash includes: "web/_site/.", name: "docs" + } + } + stage('Docs') { + steps { + sh '''cd docs + dotnet tool restore + dotnet docfx''' + stash includes: "docs/_site/.", name: "docs" + } + } } } - stage('Docs') { - when { - branch 'main' - } + stage('Publish') { + when { branch 'main' } + agent { label 'web' } + options { skipDefaultCheckout() } steps { - sh '''cd docs - dotnet tool restore - dotnet docfx''' + unstash 'site' + sh 'rm -rf /var/www/tinylifegame/*' + sh 'cp -r web/_site/. /var/www/tinylifegame/' + + unstash 'docs' sh 'rm -rf /var/www/tinylifedocs/*' sh 'cp -r docs/_site/. /var/www/tinylifedocs/' }