一大波改动
这个提交包含在:
父节点
e81bf89697
当前提交
aa20a790a1
13
Jenkinsfile
vendored
13
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,10 +97,7 @@ pipeline {
|
|||||||
|
|
||||||
stage('Publish to Nexus') {
|
stage('Publish to Nexus') {
|
||||||
when {
|
when {
|
||||||
allOf {
|
expression { return params.PUBLISH }
|
||||||
branch 'main'
|
|
||||||
expression { return params.PUBLISH }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
steps {
|
steps {
|
||||||
script {
|
script {
|
||||||
|
|||||||
正在加载...
在新工单中引用
屏蔽一个用户