This is an automated email from the ASF dual-hosted git repository.

sjaranowski pushed a commit to branch jenkis-fix
in repository https://gitbox.apache.org/repos/asf/maven-dist-tool.git

commit e06d5e38d69fc70a8653d3356319bb7dcf63a948
Author: Slawomir Jaranowski <s.jaranow...@gmail.com>
AuthorDate: Wed Oct 30 21:49:30 2024 +0100

    Improve jenkins build
    
    - publish only on master
---
 Jenkinsfile | 33 ++++++++++++++++++++++++---------
 1 file changed, 24 insertions(+), 9 deletions(-)

diff --git a/Jenkinsfile b/Jenkinsfile
index 115ed8c..3505046 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -35,26 +35,41 @@ pipeline {
         }
         stage('Check') {
             when {
-                branch 'master'
+                not { branch 'master' }
             }
             steps {
                 withMaven(jdk:'jdk_17_latest', maven:'maven_3_latest', 
mavenLocalRepo:'.repository', options: [
                   artifactsPublisher(disabled: true),
                   findbugsPublisher(disabled: true),
                 ]) {
-                    sh "mvn -ntp -V -e -Preporting -Dscreenshot=false clean 
install site"
+                    try {
+                        sh "mvn -ntp -V -e -Preporting -Dscreenshot=clean 
install site"
+                    } finally {
+                        archiveArtifacts artifacts: 
"**/target/site/**/*",allowEmptyArchive: true
+                    }
                 }
             }
         }
-    }
-    post {
-        always {
-            // not sure what is this
-            //jenkinsNotify()
-            archiveArtifacts artifacts: "**/site/*.*",allowEmptyArchive: true
-            publishHTML([allowMissing: false, alwaysLinkToLastBuild: true, 
keepAll: true, reportDir: "${env.WORKSPACE}/target/site", reportFiles: 
'index.html', reportName: 'site', reportTitles: ''])
+        stage('Publish') {
+            when {
+                branch 'master'
+            }
+            steps {
+                withMaven(jdk:'jdk_17_latest', maven:'maven_3_latest', 
mavenLocalRepo:'.repository', options: [
+                  artifactsPublisher(disabled: true),
+                  findbugsPublisher(disabled: true),
+                ]) {
+                    try {
+                        sh "mvn -ntp -V -e -Preporting -Dscreenshot=false 
clean install site"
+                    } finally {
+                        archiveArtifacts artifacts: 
"**/target/site/**/*",allowEmptyArchive: true
+                        publishHTML([allowMissing: false, 
alwaysLinkToLastBuild: true, keepAll: true, reportDir: 
"${env.WORKSPACE}/target/site", reportFiles: 'index.html', reportName: 'site', 
reportTitles: ''])
+                    }
+                }
+            }
         }
     }
+
     options {
         buildDiscarder(logRotator(numToKeepStr:'15'))
         timeout(time: 10, unit: 'MINUTES')

Reply via email to