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
6
Jenkinsfile
vendored
6
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,20 +116,18 @@ 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 https://%GIT_USER%:%GIT_PASS%@xuqinmin.com/xuqmGroup/XuqmGroup-AndroidSDK.git HEAD:main
|
git push origin main
|
||||||
"""
|
"""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
post {
|
post {
|
||||||
success { echo "Android SDK 构建成功" }
|
success { echo "Android SDK 构建成功" }
|
||||||
|
|||||||
正在加载...
在新工单中引用
屏蔽一个用户