一大波改动
这个提交包含在:
父节点
60ac8f0283
当前提交
7217b6bcfc
18
Jenkinsfile
vendored
18
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: '发布版本号(留空自动递增)')
|
string(name: 'VERSION', defaultValue: '', description: '发布版本号(留空自动递增)')
|
||||||
booleanParam(name: 'RUN_TESTS', defaultValue: true, description: '是否运行单元测试')
|
booleanParam(name: 'RUN_TESTS', defaultValue: true, description: '是否运行单元测试')
|
||||||
booleanParam(name: 'PUBLISH_SPM', defaultValue: true, description: '发布 SPM 版本(打 Git Tag)')
|
booleanParam(name: 'PUBLISH_SPM', defaultValue: true, description: '发布 SPM 版本(打 Git Tag)')
|
||||||
@ -23,7 +22,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 {
|
||||||
env.GIT_COMMIT_SHORT = sh(script: 'git rev-parse --short HEAD', returnStdout: true).trim()
|
env.GIT_COMMIT_SHORT = sh(script: 'git rev-parse --short HEAD', returnStdout: true).trim()
|
||||||
if (params.VERSION?.trim()) {
|
if (params.VERSION?.trim()) {
|
||||||
@ -74,10 +78,7 @@ pipeline {
|
|||||||
|
|
||||||
stage('Publish SPM (Git Tag)') {
|
stage('Publish SPM (Git Tag)') {
|
||||||
when {
|
when {
|
||||||
allOf {
|
expression { return params.PUBLISH_SPM }
|
||||||
branch 'main'
|
|
||||||
expression { return params.PUBLISH_SPM }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
steps {
|
steps {
|
||||||
withCredentials([usernamePassword(credentialsId: 'gitlab-credentials', passwordVariable: 'GIT_PASS', usernameVariable: 'GIT_USER')]) {
|
withCredentials([usernamePassword(credentialsId: 'gitlab-credentials', passwordVariable: 'GIT_PASS', usernameVariable: 'GIT_USER')]) {
|
||||||
@ -95,10 +96,7 @@ pipeline {
|
|||||||
|
|
||||||
stage('Publish CocoaPods') {
|
stage('Publish CocoaPods') {
|
||||||
when {
|
when {
|
||||||
allOf {
|
expression { return params.PUBLISH_PODS }
|
||||||
branch 'main'
|
|
||||||
expression { return params.PUBLISH_PODS }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
steps {
|
steps {
|
||||||
sh """
|
sh """
|
||||||
|
|||||||
正在加载...
在新工单中引用
屏蔽一个用户