Skip to content

Commit

Permalink
XIVY-15201 push pages using native GIT cli
Browse files Browse the repository at this point in the history
  • Loading branch information
ivy-rew committed Nov 15, 2024
1 parent fb8140e commit dafb758
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 44 deletions.
58 changes: 47 additions & 11 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,56 @@ pipeline {
}

stages {
stage('build') {
// stage('build') {
// steps {
// script {
// setupGPGEnvironment()
// withCredentials([string(credentialsId: 'gpg.password', variable: 'GPG_PWD')]) {
// def phase = isReleaseOrMasterBranch() ? 'deploy' : 'verify'
// maven cmd: "clean verify " +
// "-Dgpg.skip=false " +
// "-Dgpg.project-build.password='${env.GPG_PWD}' " +
// "-Divy.engine.list.url=${params.engineListUrl} " +
// "-Dmaven.test.failure.ignore=true"
// }
// collectBuildArtifacts()
// }
// }
// }
stage('deploy-site') {
// when {
// expression { !params.skipGitHubSite && isReleaseOrMasterBranch() }
// }
steps {
script {
setupGPGEnvironment()
withCredentials([string(credentialsId: 'gpg.password', variable: 'GPG_PWD')]) {
def phase = isReleaseOrMasterBranch() ? 'deploy site-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"
maven cmd: "clean site " +
"-Divy.engine.list.url=${params.engineListUrl} "

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})"
withCredentials([file(credentialsId: 'github-ivyteam-token-repo-manager', variable: 'tokenFile')]) {
sh """
git config --global user.name 'ivy-team'
git config --global user.email '[email protected]'
#gh auth login --with-token < ${tokenFile}
git clone -b gh-pages [email protected]:axonivy/project-build-plugin.git target/site-deployer
cd target/site-deployer
git checkout -b ${branch}
cd ../site
cp -r -v . ../site-deployer
cd ../site-deployer
if [ -z `git --no-pager diff` ]; then
git add .
git commit -m '${message}'
git push origin HEAD:gh-pages
fi
"""
}
}
}
collectBuildArtifacts()
}
}
}
Expand Down
34 changes: 1 addition & 33 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -295,37 +294,6 @@
</execution>
</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>
<configuration>
<server>github.ivy-team.oauth</server>
<merge>true</merge>
<skip>${github.site.skip}</skip>
</configuration>
</plugin>
</plugins>

<pluginManagement>
Expand All @@ -352,7 +320,7 @@
<configuration>
<tagNameFormat>v@{project.version}</tagNameFormat>
<releaseProfiles>release</releaseProfiles>
<goals>deploy site-deploy</goals>
<goals>deploy site</goals>
</configuration>
</plugin>
</plugins>
Expand Down

0 comments on commit dafb758

Please sign in to comment.