fix(ci): commit version bump back to git after publish

The Jenkinsfile bumped PUBLISH_VERSION during the run but never
committed the change, causing every run to start from the same
base version. Now commits gradle.properties back to main after
successful Nexus publish.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
这个提交包含在:
XuqmGroup 2026-05-23 01:51:00 +08:00
父节点 4fcaba3338
当前提交 086900cd26

17
Jenkinsfile vendored
查看文件

@ -75,6 +75,7 @@ pipeline {
} }
def newVer = parts.join('.') def newVer = parts.join('.')
echo "Auto-bumped PUBLISH_VERSION: ${currentVer} → ${newVer}" echo "Auto-bumped PUBLISH_VERSION: ${currentVer} → ${newVer}"
env.NEW_VERSION = newVer
bat "powershell -Command \"(Get-Content gradle.properties) -replace '^PUBLISH_VERSION=.*', 'PUBLISH_VERSION=${newVer}' | Set-Content gradle.properties\"" bat "powershell -Command \"(Get-Content gradle.properties) -replace '^PUBLISH_VERSION=.*', 'PUBLISH_VERSION=${newVer}' | Set-Content gradle.properties\""
@ -112,6 +113,22 @@ 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
"""
}
}
}
}
} }
post { post {