diff --git a/Jenkinsfile b/Jenkinsfile index a3ace07..790c69a 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -75,6 +75,7 @@ pipeline { } def newVer = parts.join('.') 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\"" @@ -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 {