一大波改动

这个提交包含在:
XuqmGroup 2026-05-16 12:48:17 +08:00
父节点 e81bf89697
当前提交 aa20a790a1

11
Jenkinsfile vendored
查看文件

@ -2,7 +2,6 @@ pipeline {
agent any agent any
parameters { parameters {
string(name: 'BRANCH', defaultValue: 'main', description: 'Git 分支名')
string(name: 'VERSION', defaultValue: '', description: '发布版本号(留空使用 gradle.properties 中的 PUBLISH_VERSION') string(name: 'VERSION', defaultValue: '', description: '发布版本号(留空使用 gradle.properties 中的 PUBLISH_VERSION')
booleanParam(name: 'RUN_TESTS', defaultValue: true, description: '是否运行自动化测试') booleanParam(name: 'RUN_TESTS', defaultValue: true, description: '是否运行自动化测试')
booleanParam(name: 'PUBLISH', defaultValue: true, description: '是否发布到 Nexus') booleanParam(name: 'PUBLISH', defaultValue: true, description: '是否发布到 Nexus')
@ -16,7 +15,12 @@ pipeline {
stages { stages {
stage('Checkout') { stage('Checkout') {
steps { steps {
checkout scm checkout([
$class: 'GitSCM',
branches: [[name: 'main']],
extensions: [[$class: 'CleanBeforeCheckout']],
userRemoteConfigs: scm.userRemoteConfigs
])
script { script {
if (params.VERSION?.trim()) { if (params.VERSION?.trim()) {
bat "powershell -Command \"(Get-Content gradle.properties) -replace '^PUBLISH_VERSION=.*', 'PUBLISH_VERSION=${params.VERSION}' | Set-Content gradle.properties\"" bat "powershell -Command \"(Get-Content gradle.properties) -replace '^PUBLISH_VERSION=.*', 'PUBLISH_VERSION=${params.VERSION}' | Set-Content gradle.properties\""
@ -93,11 +97,8 @@ pipeline {
stage('Publish to Nexus') { stage('Publish to Nexus') {
when { when {
allOf {
branch 'main'
expression { return params.PUBLISH } expression { return params.PUBLISH }
} }
}
steps { steps {
script { script {
def versionArg = params.VERSION?.trim() ? "-PPUBLISH_VERSION=${params.VERSION}" : '' def versionArg = params.VERSION?.trim() ? "-PPUBLISH_VERSION=${params.VERSION}" : ''