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 0fb381e
Showing 1 changed file with 56 additions and 1 deletion.
57 changes: 56 additions & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ pipeline {
setupGPGEnvironment()
withCredentials([string(credentialsId: 'gpg.password', variable: 'GPG_PWD')]) {
def phase = isReleaseOrMasterBranch() ? 'deploy site-deploy' : 'verify'
maven cmd: "clean ${phase} " +
maven cmd: "clean verify " +
"-Dgpg.skip=false " +
"-Dgpg.project-build.password='${env.GPG_PWD}' " +
"-Dgithub.site.skip=${params.skipGitHubSite} " +
Expand All @@ -39,6 +39,61 @@ pipeline {
}
}
}
stage('deploy-site') {
when {
expression { isReleaseOrMasterBranch() }
}
steps {
script {
setupGPGEnvironment()
withCredentials([string(credentialsId: 'gpg.password', variable: 'GPG_PWD')]) {
maven cmd: "site " +
"-Divy.engine.list.url=${params.engineListUrl} "
}

// 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}"

def branch = "pages_$BRANCH_NAME-$BUILD_NUMBER"
withEnv(['GIT_SSH_COMMAND=ssh -o StrictHostKeyChecking=no']) {
sshagent(credentials: ['github-axonivy']) {
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'"
sh "git config --global user.email '[email protected]'"
sh "gh auth login --with-token < ${tokenFile}"
sh '''
gh repo clone axonivy/project-build-plugin target/site-deployer
cd target/site-deployer
git checkout -b ${branch} gh-pages
cp -r ../site .
git add .
git commit -m "${message}"
git push origin ${branch}
'''
}
}
}

}
}
}
}
}

Expand Down

0 comments on commit 0fb381e

Please sign in to comment.