diff --git a/Jenkinsfile b/Jenkinsfile index 4d21ab20..5e697d18 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -28,7 +28,7 @@ pipeline { setupGPGEnvironment() withCredentials([string(credentialsId: 'gpg.password', variable: 'GPG_PWD')]) { def phase = isReleaseOrMasterBranch() ? 'deploy site-deploy' : 'verify' - maven cmd: "clean ${phase} " + + maven cmd: "clean verify " + "-Dgpg.skip=false " + "-Dgpg.project-build.password='${env.GPG_PWD}' " + "-Dgithub.site.skip=${params.skipGitHubSite} " + @@ -38,6 +38,61 @@ pipeline { collectBuildArtifacts() } } + }, + stage('deploy-site') { + when { + expression { isReleaseOrMasterBranch() } + } + steps { + script { + setupGPGEnvironment() + withCredentials([string(credentialsId: 'gpg.password', variable: 'GPG_PWD')]) { + maven cmd: "site " + + "-Divy.engine.list.url=${params.engineListUrl} " + } + + // sh ''' + // tmpOut=$(mktemp -d -t "plugin-site-XXXXX") + // cp -r . $tmpOut + // cd $tmpOut + // git checkout -b gh_pages + + + // cd target/site && zip -r $tmpOut/site.zip . + // git checkout -b origin/gh_pages + // unzip $tmpOut/site.zip + // git add . + // git commit + // ''' + + + + + // sh "git checkout -b ${targetBranch}" + + def branch = "pages_$BRANCH_NAME-$BUILD_NUMBER" + withEnv(['GIT_SSH_COMMAND=ssh -o StrictHostKeyChecking=no']) { + sshagent(credentials: ['github-axonivy']) { + def message = "Update site (${env.BRANCH_NAME})" + withCredentials([file(credentialsId: 'github-ivyteam-token-repo-manager', variable: 'tokenFile')]) { + sh "git config --global user.name 'ivy-team'" + sh "git config --global user.email 'info@ivyteam.ch'" + sh "gh auth login --with-token < ${tokenFile}" + sh ''' + gh repo clone axonivy/project-build-plugin target/site-deployer + cd target/site-deployer + git checkout -b ${branch} gh-pages + cp -r ../site . + git add . + git commit -m "${message}" + git push origin ${branch} + ''' + } + } + } + + } + } } } }