-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #534 from axonivy/siteDeployV2
Deploy github site using maven-scm-publish plugin 🏗️
- Loading branch information
Showing
3 changed files
with
37 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,10 +12,6 @@ pipeline { | |
} | ||
|
||
parameters { | ||
booleanParam(name: 'skipGitHubSite', | ||
description: 'If checked the plugin documentation on GitHub will NOT be updated', | ||
defaultValue: true) | ||
|
||
string(name: 'engineListUrl', | ||
description: 'Engine to use for build', | ||
defaultValue: 'https://product.ivyteam.io') | ||
|
@@ -27,18 +23,37 @@ pipeline { | |
script { | ||
setupGPGEnvironment() | ||
withCredentials([string(credentialsId: 'gpg.password', variable: 'GPG_PWD')]) { | ||
def phase = isReleaseOrMasterBranch() ? 'deploy site-deploy' : 'verify' | ||
def phase = isReleaseOrMasterBranch() ? 'deploy' : 'verify' | ||
maven cmd: "clean ${phase} " + | ||
"-Dgpg.skip=false " + | ||
"-Dgpg.project-build.password='${env.GPG_PWD}' " + | ||
"-Dgithub.site.skip=${params.skipGitHubSite} " + | ||
"-Divy.engine.list.url=${params.engineListUrl} " + | ||
"-Dmaven.test.failure.ignore=true" | ||
} | ||
collectBuildArtifacts() | ||
} | ||
} | ||
} | ||
stage('deploy-site') { | ||
when { | ||
expression { isReleaseOrMasterBranch() } | ||
} | ||
steps { | ||
script { | ||
withEnv(['GIT_SSH_COMMAND=ssh -o StrictHostKeyChecking=no']) { | ||
sshagent(credentials: ['github-axonivy']) { | ||
def branch = "pages_$BRANCH_NAME-$BUILD_NUMBER" | ||
def message = "Update site (${env.BRANCH_NAME})" | ||
sh """ | ||
git config --global user.name 'ivy-team' | ||
git config --global user.email '[email protected]' | ||
""" | ||
maven cmd: "site site:stage scm-publish:publish-scm" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -49,7 +49,6 @@ | |
<other.site.name>Stable</other.site.name> | ||
<autoRelease>true</autoRelease> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
<github.site.skip>true</github.site.skip> | ||
</properties> | ||
|
||
<distributionManagement> | ||
|
@@ -63,6 +62,10 @@ | |
<name>Sonatype Releases Repo</name> | ||
<url>https://oss.sonatype.org/content/repositories/releases/</url> | ||
</repository> | ||
<site> | ||
<id>github</id> | ||
<url>scm:git:[email protected]:axonivy/project-build-plugin.git</url> | ||
</site> | ||
</distributionManagement> | ||
|
||
<dependencies> | ||
|
@@ -284,7 +287,10 @@ | |
<id>gh-pages.redirect.page</id> | ||
<configuration> | ||
<target> | ||
<copy todir="${project.build.directory}/site-redirect"> | ||
<move todir="${project.build.directory}/site/${site.path}/${pluginVersion.majorVersion}.${pluginVersion.minorVersion}" > | ||
<fileset dir="${project.build.directory}/site" /> | ||
</move> | ||
<copy todir="${project.build.directory}/site/${site.path}/" > | ||
<fileset dir="src/site/gh/pages/" /> | ||
<filterset id="replaceProductAndVersion"> | ||
<filter token="version" value="${pluginVersion.majorVersion}.${pluginVersion.minorVersion}" /> | ||
|
@@ -296,34 +302,12 @@ | |
</executions> | ||
</plugin> | ||
<plugin> | ||
<groupId>com.github.github</groupId> | ||
<artifactId>site-maven-plugin</artifactId> | ||
<version>0.12</version> | ||
<executions> | ||
<execution> | ||
<id>deploy.mojo.description.to.github</id> | ||
<goals><goal>site</goal></goals> | ||
<phase>site-deploy</phase> | ||
<configuration> | ||
<message>update maven plugin mojo description</message> | ||
<path>${site.path}/${pluginVersion.majorVersion}.${pluginVersion.minorVersion}</path> | ||
</configuration> | ||
</execution> | ||
<execution> | ||
<id>deploy.site.redirect.to.github</id> | ||
<goals><goal>site</goal></goals> | ||
<phase>site-deploy</phase> | ||
<configuration> | ||
<message>update maven plugin mojo redirect</message> | ||
<path>${site.path}</path> | ||
<outputDirectory>${project.build.directory}/site-redirect</outputDirectory> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-scm-publish-plugin</artifactId> | ||
<version>3.3.0</version> | ||
<configuration> | ||
<server>github.ivy-team.oauth</server> | ||
<merge>true</merge> | ||
<skip>${github.site.skip}</skip> | ||
<scmBranch>gh-pages</scmBranch> | ||
<skipDeletedFiles>true</skipDeletedFiles> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
|
@@ -349,7 +333,7 @@ | |
<configuration> | ||
<tagNameFormat>v@{project.version}</tagNameFormat> | ||
<releaseProfiles>release</releaseProfiles> | ||
<goals>deploy site-deploy</goals> | ||
<goals>deploy site</goals> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
|