diff --git a/Jenkinsfile b/Jenkinsfile index 0fd41d2..fe287f8 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -50,10 +50,9 @@ pipeline { stage('Resolve Versions') { steps { script { - def currentVer = bat( - script: "@powershell -Command \"(Get-Content gradle.properties | Select-String '^PUBLISH_VERSION=').Line.Split('=')[1]\"", - returnStdout: true - ).replaceAll("\\r","").replaceAll("\\n","").trim() + // Read version using Groovy to avoid PowerShell encoding issues + def props = readProperties file: 'gradle.properties' + def currentVer = props['PUBLISH_VERSION'] ?: '0.1.0' echo "Current PUBLISH_VERSION: ${currentVer}" def parts = currentVer.tokenize('.') @@ -77,7 +76,10 @@ pipeline { 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\"" + // Write back using Groovy to avoid PowerShell encoding issues + def content = readFile('gradle.properties') + content = content.replaceAll(/(?m)^PUBLISH_VERSION=.*/, "PUBLISH_VERSION=${newVer}") + writeFile file: 'gradle.properties', text: content def modules = env.PUBLISH_MODULES.split(',').toList() def versionMap = [:] @@ -122,6 +124,7 @@ pipeline { 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 pull --rebase origin main git push origin main """ }