This is an automated email from the ASF dual-hosted git repository. zregvart pushed a commit to branch jenkinsfile in repository https://gitbox.apache.org/repos/asf/camel-website.git
commit 4987933318e16bc6f4b43b0f26bd242d20af43dd Author: Zoran Regvart <zregv...@apache.org> AuthorDate: Fri Dec 14 09:24:18 2018 +0100 Test preview --- Jenkinsfile | 116 +++++++++++++++++++++++++++++++++--------------------------- 1 file changed, 64 insertions(+), 52 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 5d17f54..fb1516d 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -21,66 +21,78 @@ def NODE_IMAGE = 'node:11' def YARN_OPTS = '--non-interactive --frozen-lockfile --json --cache-folder $WORKSPACE/.yarn --modules-folder node_modules' pipeline { - agent { - label "$NODE" - } + agent { + label "$NODE" + } - options { - buildDiscarder( - logRotator(artifactNumToKeepStr: '5', numToKeepStr: '10') + options { + buildDiscarder( + logRotator(artifactNumToKeepStr: '5', numToKeepStr: '10') ) - } + } - stages { - stage('Build') { - agent { - docker { - label "$NODE" - image "$NODE_IMAGE" - reuseNode true - } - } + stages { + stage('Build') { + agent { + docker { + label "$NODE" + image "$NODE_IMAGE" + reuseNode true + } + } - stages { - stage('Theme') { - steps { - sh "cd antora-ui-camel && yarn $YARN_OPTS install" - sh "cd antora-ui-camel && yarn $YARN_OPTS gulp pack" - } - } + stages { + stage('Theme') { + steps { + sh "cd antora-ui-camel && yarn $YARN_OPTS install" + sh "cd antora-ui-camel && yarn $YARN_OPTS gulp pack" + } + } - stage('Documentation') { - steps { - sh "yarn $YARN_OPTS install" - sh "yarn $YARN_OPTS antora generate --cache-dir $WORKSPACE/.antora --clean --redirect-facility disabled site.yml" - } - } + stage('Documentation') { + steps { + sh "yarn $YARN_OPTS install" + sh "yarn $YARN_OPTS antora generate --cache-dir $WORKSPACE/.antora --clean --redirect-facility disabled site.yml" + } + } - stage('Website') { - steps { - sh "yarn $YARN_OPTS install" - sh "yarn $YARN_OPTS hugo" - } - } - } + stage('Website') { + steps { + sh "yarn $YARN_OPTS install" + sh "yarn $YARN_OPTS hugo" + } } + } + } - stage('Deploy') { - when { - branch 'master' - } + stage('Deploy') { + when { + branch 'master' + } + + steps { + dir('deploy/staging') { + deleteDir() + sh 'git clone -b asf-site https://gitbox.apache.org/repos/asf/camel-website.git .' + sh 'git rm -r *' + sh "cp -R $WORKSPACE/public/* ." + sh 'git add .' + sh 'git commit -m "Website updated to $(git rev-parse --short HEAD)"' + sh 'git push origin asf-site' + } + } + } + + stage('Preview') { + when { + not { + branch 'master' + } + } - steps { - dir('deploy/staging') { - deleteDir() - sh 'git clone -b asf-site https://gitbox.apache.org/repos/asf/camel-website.git .' - sh 'git rm -r *' - sh "cp -R $WORKSPACE/public/* ." - sh 'git add .' - sh 'git commit -m "Website updated to $(git rev-parse --short HEAD)"' - sh 'git push origin asf-site' - } - } - } + steps { + publishHTML([reportDir: 'public', reportFiles: 'index.html', reportName: 'Preview']) + } } + } }