This is an automated email from the ASF dual-hosted git repository. ieugen pushed a commit to branch JAMES-3226-site-build in repository https://gitbox.apache.org/repos/asf/james-site.git
The following commit(s) were added to refs/heads/JAMES-3226-site-build by this push: new e055685 [JAMES-3226] Publish the staging website automatically e055685 is described below commit e055685e423b92fdc5199d8043bbf1b4c9779aae Author: Eugen Stan <eu...@ieugen.ro> AuthorDate: Tue Jul 7 18:05:55 2020 +0300 [JAMES-3226] Publish the staging website automatically --- .gitignore | 3 ++- Jenkinsfile | 15 +++++++++++++-- doc-sites/build.gradle | 17 ++++------------- jenkins.pom | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 68 insertions(+), 16 deletions(-) diff --git a/.gitignore b/.gitignore index 8ba4c7b..c81bc51 100644 --- a/.gitignore +++ b/.gitignore @@ -7,4 +7,5 @@ build .vscode .project -node_modules \ No newline at end of file +node_modules +target \ No newline at end of file diff --git a/Jenkinsfile b/Jenkinsfile index b4fc121..e7d8d72 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -37,7 +37,7 @@ pipeline { options { // Configure an overall timeout for the build of one hour. - timeout(time: 4, unit: 'HOURS') + timeout(time: 30, unit: 'MINUTES') // When we have test-fails e.g. we don't need to run the remaining steps skipStagesAfterUnstable() buildDiscarder( @@ -50,6 +50,7 @@ pipeline { stage('Build') { steps { sh "./gradlew clean build" + stash includes: 'doc-sites/build/site/**/*', name: 'apache-james-site' } } @@ -60,8 +61,18 @@ pipeline { } stage('Publish') { + agent { + node { + label 'git-websites' + } + } + steps { - echo "These are not the publish commands you are looking for." + echo "Deploy staging James website." + + unstash 'apache-james-site' + + sh 'mvn -f jenkins.pom -X -P deploy-site scm-publish:publish-scm' } } } diff --git a/doc-sites/build.gradle b/doc-sites/build.gradle index 69fded0..e9fe967 100644 --- a/doc-sites/build.gradle +++ b/doc-sites/build.gradle @@ -1,8 +1,6 @@ plugins { id 'base' id 'com.github.node-gradle.node' version '2.2.4' - id 'org.ajoberstar.grgit' version '4.0.2' - id 'org.ajoberstar.git-publish' version '2.1.3' } node { @@ -11,23 +9,17 @@ node { download = true } -def siteOutputDir = "$buildDir/site" - -gitPublish { - repoDir = file(siteOutputDir) - branch = 'asf-staging-test' -} +def siteOutputDir = "${buildDir}/site"; task generateDocs(type: NpxTask) { dependsOn npmInstall - // dependsOn gitPublishReset inputs.files('package.json', 'package-lock.json', 'antora-playbook.yml') inputs.dir(fileTree('node_modules').exclude('.cache')) - outputs.dir(gitPublish.repoDir) + outputs.dir(siteOutputDir) command = 'antora' - args = ['antora-playbook.yml', '--to-dir', siteOutputDir ] + args = ['antora-playbook.yml' ] } task copySomeFiles(type: Copy) { @@ -40,5 +32,4 @@ task buildSite() { dependsOn generateDocs, copySomeFiles } -tasks.build.dependsOn buildSite -tasks.gitPublishCommit.dependsOn buildSite \ No newline at end of file +tasks.build.dependsOn buildSite \ No newline at end of file diff --git a/jenkins.pom b/jenkins.pom new file mode 100644 index 0000000..d123aba --- /dev/null +++ b/jenkins.pom @@ -0,0 +1,49 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.apache</groupId> + <artifactId>apache</artifactId> + <version>23</version> + </parent> + + <groupId>org.apache.james</groupId> + <artifactId>james-jenkins-tools</artifactId> + <version>0.1.0-SNAPSHOT</version> + <packaging>pom</packaging> + + <name>Apache James: Jenkins Tools</name> + <description>Set of helpers to do individual tasks only needed on our Jenkins build.</description> + + <!-- See https://cwiki.apache.org/confluence/display/INFRA/Multibranch+Pipeline+recipes#MultibranchPipelinerecipes-DeployingWebsiteContent --> + + <!-- We are publishing the site to a different repository --> + <distributionManagement> + <site> + <id>apache.website</id> + <url>scm:git:https://gitbox.apache.org/repos/asf/james-site.git</url> + </site> + </distributionManagement> + + <profiles> + <profile> + <id>deploy-site</id> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-scm-publish-plugin</artifactId> + <configuration> + <content>doc-sites/build/site</content> + <scmBranch>asf-staging</scmBranch> + </configuration> + </plugin> + </plugins> + </build> + </profile> + </profiles> + +</project> \ No newline at end of file