From aa20a790a1b4e2d5d4cc147d4325f8270c29f6fa Mon Sep 17 00:00:00 2001 From: XuqmGroup Date: Sat, 16 May 2026 12:48:17 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=80=E5=A4=A7=E6=B3=A2=E6=94=B9=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Jenkinsfile | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index c30ac2c..bd30242 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -2,7 +2,6 @@ pipeline { agent any parameters { - string(name: 'BRANCH', defaultValue: 'main', description: 'Git 分支名') string(name: 'VERSION', defaultValue: '', description: '发布版本号(留空使用 gradle.properties 中的 PUBLISH_VERSION)') booleanParam(name: 'RUN_TESTS', defaultValue: true, description: '是否运行自动化测试') booleanParam(name: 'PUBLISH', defaultValue: true, description: '是否发布到 Nexus') @@ -16,7 +15,12 @@ pipeline { stages { stage('Checkout') { steps { - checkout scm + checkout([ + $class: 'GitSCM', + branches: [[name: 'main']], + extensions: [[$class: 'CleanBeforeCheckout']], + userRemoteConfigs: scm.userRemoteConfigs + ]) script { if (params.VERSION?.trim()) { bat "powershell -Command \"(Get-Content gradle.properties) -replace '^PUBLISH_VERSION=.*', 'PUBLISH_VERSION=${params.VERSION}' | Set-Content gradle.properties\"" @@ -93,10 +97,7 @@ pipeline { stage('Publish to Nexus') { when { - allOf { - branch 'main' - expression { return params.PUBLISH } - } + expression { return params.PUBLISH } } steps { script {