-
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.
- Loading branch information
Showing
1 changed file
with
70 additions
and
9 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 |
---|---|---|
|
@@ -22,20 +22,81 @@ pipeline { | |
} | ||
|
||
stages { | ||
stage('build') { | ||
// stage('build') { | ||
// steps { | ||
// script { | ||
// setupGPGEnvironment() | ||
// withCredentials([string(credentialsId: 'gpg.password', variable: 'GPG_PWD')]) { | ||
// def phase = isReleaseOrMasterBranch() ? 'deploy site-deploy' : 'verify' | ||
// maven cmd: "clean verify " + | ||
// "-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 { | ||
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} " | ||
} | ||
collectBuildArtifacts() | ||
|
||
// 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}" | ||
|
||
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} | ||
""" | ||
sh """ | ||
echo 'preparing ${branch}' | ||
gh repo clone [email protected]:axonivy/project-build-plugin.git target/site-deployer | ||
cd target/site-deployer | ||
git checkout -b ${branch} origin/gh-pages | ||
git --no-pager status | ||
cp -r -v ../site/ . | ||
ls -la | ||
git add . | ||
git commit -m '${message}' | ||
#gh pr create --base 'gh-pages' --fill | ||
git push origin ${branch} | ||
""" | ||
} | ||
} | ||
} | ||
|
||
} | ||
} | ||
} | ||
|