ci: support Windows SSH credential binding

这个提交包含在:
XuqmGroup 2026-07-27 12:58:29 +08:00
父节点 d3c0c872a6
当前提交 e991c06bff
共有 2 个文件被更改,包括 21 次插入9 次删除

9
Jenkinsfile vendored
查看文件

@ -188,8 +188,11 @@ pipeline {
stage('Commit Version Bump') { stage('Commit Version Bump') {
when { expression { !params.SNAPSHOT } } when { expression { !params.SNAPSHOT } }
steps { steps {
sshagent(credentials: ['jenkins-ssh-key']) {
script { script {
withCredentials([sshUserPrivateKey(credentialsId: 'jenkins-ssh-key', keyFileVariable: 'GIT_SSH_KEY')]) {
writeFile file: 'git-ssh.cmd', text: '@echo off\r\nssh -i "%GIT_SSH_KEY%" -o IdentitiesOnly=yes %*\r\n', encoding: 'UTF-8'
try {
withEnv(["GIT_SSH=${pwd()}\\git-ssh.cmd"]) {
bat """ bat """
git config user.email "jenkins@xuqm.com" git config user.email "jenkins@xuqm.com"
git config user.name "Jenkins CI" git config user.name "Jenkins CI"
@ -198,6 +201,10 @@ pipeline {
git push origin HEAD:main git push origin HEAD:main
""" """
} }
} finally {
bat 'if exist git-ssh.cmd del /f /q git-ssh.cmd'
}
}
} }
} }
} }

查看文件

@ -483,3 +483,8 @@ controller?.postMessageToWeb("window.dispatchEvent(new CustomEvent('nativeMsg',
``` ```
发布至 `https://nexus.xuqinmin.com/repository/android-hosted/`,groupId `com.xuqm`,版本号在各模块 `build.gradle.kts` 中维护。 发布至 `https://nexus.xuqinmin.com/repository/android-hosted/`,groupId `com.xuqm`,版本号在各模块 `build.gradle.kts` 中维护。
### Jenkins SSH
Windows Jenkins 节点通过 `jenkins-ssh-key` 私钥凭据生成构建期临时
`git-ssh.cmd` 执行版本提交推送,作用域结束后立即删除该脚本。