fix(ci): fix version bump and git push
- Strip \r\n from PowerShell output to fix version parsing (was causing "1.0.3 → 1.0.3" instead of "1.0.3 → 1.0.4") - Remove gitlab-credentials dependency, use git remote URL which already has the access token embedded Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
这个提交包含在:
父节点
cff30338b2
当前提交
c60bc15a93
20
Jenkinsfile
vendored
20
Jenkinsfile
vendored
@ -53,7 +53,7 @@ pipeline {
|
||||
def currentVer = bat(
|
||||
script: "@powershell -Command \"(Get-Content gradle.properties | Select-String '^PUBLISH_VERSION=').Line.Split('=')[1]\"",
|
||||
returnStdout: true
|
||||
).trim()
|
||||
).replaceAll("\\r","").replaceAll("\\n","").trim()
|
||||
echo "Current PUBLISH_VERSION: ${currentVer}"
|
||||
|
||||
def parts = currentVer.tokenize('.')
|
||||
@ -116,16 +116,14 @@ pipeline {
|
||||
|
||||
stage('Commit Version Bump') {
|
||||
steps {
|
||||
withCredentials([usernamePassword(credentialsId: 'gitlab-credentials', passwordVariable: 'GIT_PASS', usernameVariable: 'GIT_USER')]) {
|
||||
script {
|
||||
bat """
|
||||
git config user.email "jenkins@xuqm.com"
|
||||
git config user.name "Jenkins CI"
|
||||
git add gradle.properties
|
||||
git diff --cached --quiet || git commit -m "ci: bump PUBLISH_VERSION to ${env.NEW_VERSION}"
|
||||
git push https://%GIT_USER%:%GIT_PASS%@xuqinmin.com/xuqmGroup/XuqmGroup-AndroidSDK.git HEAD:main
|
||||
"""
|
||||
}
|
||||
script {
|
||||
bat """
|
||||
git config user.email "jenkins@xuqm.com"
|
||||
git config user.name "Jenkins CI"
|
||||
git add gradle.properties
|
||||
git diff --cached --quiet || git commit -m "ci: bump PUBLISH_VERSION to ${env.NEW_VERSION}"
|
||||
git push origin main
|
||||
"""
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
正在加载...
在新工单中引用
屏蔽一个用户