fix(ci): 修复凭据ID、Windows兼容性和post块上下文
这个提交包含在:
父节点
141f5e3e30
当前提交
2247c1146e
19
Jenkinsfile
vendored
19
Jenkinsfile
vendored
@ -29,8 +29,7 @@ pipeline {
|
|||||||
}
|
}
|
||||||
|
|
||||||
environment {
|
environment {
|
||||||
NEXUS_USER = credentials('nexus-android-user')
|
NEXUS_CREDS = credentials('NEXUS_CREDS')
|
||||||
NEXUS_PASS = credentials('nexus-android-pass')
|
|
||||||
}
|
}
|
||||||
|
|
||||||
stages {
|
stages {
|
||||||
@ -86,8 +85,8 @@ pipeline {
|
|||||||
script {
|
script {
|
||||||
if (!params.CUSTOM_VERSION) {
|
if (!params.CUSTOM_VERSION) {
|
||||||
// 从 gradle.properties 读取当前版本号
|
// 从 gradle.properties 读取当前版本号
|
||||||
def currentVer = sh(
|
def currentVer = bat(
|
||||||
script: "grep '^PUBLISH_VERSION=' gradle.properties | cut -d= -f2",
|
script: "@powershell -Command \"(Get-Content gradle.properties | Select-String '^PUBLISH_VERSION=').Line.Split('=')[1]\"",
|
||||||
returnStdout: true
|
returnStdout: true
|
||||||
).trim()
|
).trim()
|
||||||
echo "Current PUBLISH_VERSION: ${currentVer}"
|
echo "Current PUBLISH_VERSION: ${currentVer}"
|
||||||
@ -113,7 +112,7 @@ pipeline {
|
|||||||
echo "Auto-bumped PUBLISH_VERSION: ${currentVer} → ${newVer}"
|
echo "Auto-bumped PUBLISH_VERSION: ${currentVer} → ${newVer}"
|
||||||
|
|
||||||
// 更新 gradle.properties
|
// 更新 gradle.properties
|
||||||
sh "sed -i '' 's/^PUBLISH_VERSION=.*/PUBLISH_VERSION=${newVer}/' gradle.properties"
|
bat "powershell -Command \"(Get-Content gradle.properties) -replace '^PUBLISH_VERSION=.*', 'PUBLISH_VERSION=${newVer}' | Set-Content gradle.properties\""
|
||||||
|
|
||||||
// 用新版本号重建所有模块的 VERSION_ARGS
|
// 用新版本号重建所有模块的 VERSION_ARGS
|
||||||
def modules = env.PUBLISH_MODULES.split(',').toList()
|
def modules = env.PUBLISH_MODULES.split(',').toList()
|
||||||
@ -209,7 +208,7 @@ pipeline {
|
|||||||
script {
|
script {
|
||||||
def modules = env.PUBLISH_MODULES.split(',').toList()
|
def modules = env.PUBLISH_MODULES.split(',').toList()
|
||||||
def publishTasks = modules.collect { ":${it}:publish" }.join(' ')
|
def publishTasks = modules.collect { ":${it}:publish" }.join(' ')
|
||||||
def credArgs = "-PNEXUS_USER=%NEXUS_USER% -PNEXUS_PASSWORD=%NEXUS_PASS%"
|
def credArgs = "-PNEXUS_USER=%NEXUS_CREDS_USR% -PNEXUS_PASSWORD=%NEXUS_CREDS_PSW%"
|
||||||
bat "gradlew.bat ${publishTasks} ${env.VERSION_ARGS} ${credArgs} --no-daemon"
|
bat "gradlew.bat ${publishTasks} ${env.VERSION_ARGS} ${credArgs} --no-daemon"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -218,16 +217,24 @@ pipeline {
|
|||||||
|
|
||||||
post {
|
post {
|
||||||
always {
|
always {
|
||||||
|
script {
|
||||||
|
node {
|
||||||
bat 'adb emu kill || exit 0'
|
bat 'adb emu kill || exit 0'
|
||||||
archiveArtifacts artifacts: 'test-results-*.txt, cross-*.txt', allowEmptyArchive: true
|
archiveArtifacts artifacts: 'test-results-*.txt, cross-*.txt', allowEmptyArchive: true
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
failure {
|
failure {
|
||||||
|
script {
|
||||||
|
node {
|
||||||
bat '''
|
bat '''
|
||||||
adb -s emulator-5554 logcat -d -s XuqmImSDK:D XuqmPushSDK:W XuqmUpdateSDK:D > logcat-5554.txt || exit 0
|
adb -s emulator-5554 logcat -d -s XuqmImSDK:D XuqmPushSDK:W XuqmUpdateSDK:D > logcat-5554.txt || exit 0
|
||||||
adb -s emulator-5556 logcat -d -s XuqmImSDK:D XuqmPushSDK:W XuqmUpdateSDK:D > logcat-5556.txt || exit 0
|
adb -s emulator-5556 logcat -d -s XuqmImSDK:D XuqmPushSDK:W XuqmUpdateSDK:D > logcat-5556.txt || exit 0
|
||||||
'''
|
'''
|
||||||
archiveArtifacts artifacts: 'logcat-*.txt', allowEmptyArchive: true
|
archiveArtifacts artifacts: 'logcat-*.txt', allowEmptyArchive: true
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
success { echo "Android SDK 构建成功" }
|
success { echo "Android SDK 构建成功" }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
正在加载...
在新工单中引用
屏蔽一个用户