also build web if not publishing

This commit is contained in:
Ell 2023-04-26 12:02:26 +02:00
parent 01a054b2e7
commit aadb5d931b

29
Jenkinsfile vendored
View file

@ -1,26 +1,37 @@
pipeline { pipeline {
agent { label 'web' } agent none
stages {
stage('Build') {
agent any
stages { stages {
stage('Site') { stage('Site') {
when {
branch 'main'
}
steps { steps {
sh '''cd web sh '''cd web
bundle bundle
bundle exec jekyll build''' bundle exec jekyll build'''
sh 'rm -rf /var/www/tinylifegame/*' stash includes: "web/_site/.", name: "docs"
sh 'cp -r web/_site/. /var/www/tinylifegame/'
} }
} }
stage('Docs') { stage('Docs') {
when {
branch 'main'
}
steps { steps {
sh '''cd docs sh '''cd docs
dotnet tool restore dotnet tool restore
dotnet docfx''' dotnet docfx'''
stash includes: "docs/_site/.", name: "docs"
}
}
}
}
stage('Publish') {
when { branch 'main' }
agent { label 'web' }
options { skipDefaultCheckout() }
steps {
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 'rm -rf /var/www/tinylifedocs/*'
sh 'cp -r docs/_site/. /var/www/tinylifedocs/' sh 'cp -r docs/_site/. /var/www/tinylifedocs/'
} }