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>
这个提交包含在:
XuqmGroup 2026-05-23 01:54:28 +08:00
父节点 cff30338b2
当前提交 c60bc15a93

20
Jenkinsfile vendored
查看文件

@ -53,7 +53,7 @@ pipeline {
def currentVer = bat( def currentVer = bat(
script: "@powershell -Command \"(Get-Content gradle.properties | Select-String '^PUBLISH_VERSION=').Line.Split('=')[1]\"", script: "@powershell -Command \"(Get-Content gradle.properties | Select-String '^PUBLISH_VERSION=').Line.Split('=')[1]\"",
returnStdout: true returnStdout: true
).trim() ).replaceAll("\\r","").replaceAll("\\n","").trim()
echo "Current PUBLISH_VERSION: ${currentVer}" echo "Current PUBLISH_VERSION: ${currentVer}"
def parts = currentVer.tokenize('.') def parts = currentVer.tokenize('.')
@ -116,16 +116,14 @@ pipeline {
stage('Commit Version Bump') { stage('Commit Version Bump') {
steps { steps {
withCredentials([usernamePassword(credentialsId: 'gitlab-credentials', passwordVariable: 'GIT_PASS', usernameVariable: 'GIT_USER')]) { script {
script { 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" git add gradle.properties
git add gradle.properties git diff --cached --quiet || git commit -m "ci: bump PUBLISH_VERSION to ${env.NEW_VERSION}"
git diff --cached --quiet || git commit -m "ci: bump PUBLISH_VERSION to ${env.NEW_VERSION}" git push origin main
git push https://%GIT_USER%:%GIT_PASS%@xuqinmin.com/xuqmGroup/XuqmGroup-AndroidSDK.git HEAD:main """
"""
}
} }
} }
} }