Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Site deploy v2: history cleanup 😢 #535

Merged
merged 2 commits into from
Nov 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 21 additions & 6 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand All @@ -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"
}
}
}
}
}
}
}

Expand Down
2 changes: 2 additions & 0 deletions build/release/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ pipeline {
sh "gh auth login --with-token < ${tokenFile}"
sh "gh pr create --title '${message}' --body '${message}' --head ${targetBranch} --base ${env.BRANCH_NAME}"
}
// publish site from 'mvn release' run
maven cmd: "site:stage scm-publish:publish-scm"
}
}
}
Expand Down
44 changes: 14 additions & 30 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 All @@ -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>
Expand Down Expand Up @@ -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}" />
Expand All @@ -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>
Expand All @@ -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>
Expand Down