Skip to content

Commit

Permalink
wip: push using gh
Browse files Browse the repository at this point in the history
  • Loading branch information
ivy-rew committed Nov 15, 2024
1 parent fb8140e commit 2fe4b56
Showing 1 changed file with 70 additions and 9 deletions.
79 changes: 70 additions & 9 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -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}
"""
}
}
}

}
}
}
Expand Down

0 comments on commit 2fe4b56

Please sign in to comment.