ci: remove all params, always run all stages, lock to main
这个提交包含在:
父节点
a6a5a1e8bf
当前提交
5ec94b074b
23
Jenkinsfile
vendored
23
Jenkinsfile
vendored
@ -1,16 +1,9 @@
|
|||||||
pipeline {
|
pipeline {
|
||||||
agent any
|
agent any
|
||||||
|
|
||||||
parameters {
|
|
||||||
string(name: 'VERSION', defaultValue: '', description: '发布版本号(留空使用 package.json 中的 version)')
|
|
||||||
booleanParam(name: 'RUN_TESTS', defaultValue: true, description: '是否运行测试')
|
|
||||||
booleanParam(name: 'PUBLISH', defaultValue: true, description: '是否发布到 Nexus npm 仓库')
|
|
||||||
}
|
|
||||||
|
|
||||||
environment {
|
environment {
|
||||||
NEXUS_REGISTRY = 'https://nexus.xuqinmin.com/repository/npm-hosted/'
|
NEXUS_REGISTRY = 'https://nexus.xuqinmin.com/repository/npm-hosted/'
|
||||||
GIT_URL = 'https://xuqinmin.com/xuqmGroup/XuqmGroup-Vue3SDK.git'
|
GIT_URL = 'https://xuqinmin.com/xuqmGroup/XuqmGroup-Vue3SDK.git'
|
||||||
NODE_VERSION = '22'
|
|
||||||
}
|
}
|
||||||
|
|
||||||
options {
|
options {
|
||||||
@ -30,9 +23,6 @@ pipeline {
|
|||||||
])
|
])
|
||||||
script {
|
script {
|
||||||
env.GIT_COMMIT_SHORT = bat(script: '@git rev-parse --short HEAD', returnStdout: true).trim()
|
env.GIT_COMMIT_SHORT = bat(script: '@git rev-parse --short HEAD', returnStdout: true).trim()
|
||||||
if (params.VERSION?.trim()) {
|
|
||||||
bat "npm version ${params.VERSION} --no-git-tag-version"
|
|
||||||
}
|
|
||||||
env.PUBLISH_VERSION = bat(script: '@node -p "require(\'./package.json\').version"', returnStdout: true).trim()
|
env.PUBLISH_VERSION = bat(script: '@node -p "require(\'./package.json\').version"', returnStdout: true).trim()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -40,7 +30,7 @@ pipeline {
|
|||||||
|
|
||||||
stage('Build Info') {
|
stage('Build Info') {
|
||||||
steps {
|
steps {
|
||||||
echo "发布版本: ${env.PUBLISH_VERSION}"
|
echo "发布版本: ${env.PUBLISH_VERSION} ⚠ 发布前请确认已在 package.json 中更新版本号"
|
||||||
echo "Git Commit: ${env.GIT_COMMIT_SHORT}"
|
echo "Git Commit: ${env.GIT_COMMIT_SHORT}"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -64,7 +54,6 @@ pipeline {
|
|||||||
}
|
}
|
||||||
|
|
||||||
stage('Tests') {
|
stage('Tests') {
|
||||||
when { expression { return params.RUN_TESTS } }
|
|
||||||
steps {
|
steps {
|
||||||
bat 'npm run test > test-results.txt 2>&1 || ver>nul'
|
bat 'npm run test > test-results.txt 2>&1 || ver>nul'
|
||||||
}
|
}
|
||||||
@ -76,9 +65,6 @@ pipeline {
|
|||||||
}
|
}
|
||||||
|
|
||||||
stage('Publish to Nexus') {
|
stage('Publish to Nexus') {
|
||||||
when {
|
|
||||||
expression { return params.PUBLISH }
|
|
||||||
}
|
|
||||||
steps {
|
steps {
|
||||||
withCredentials([usernamePassword(credentialsId: 'NEXUS_CREDS', passwordVariable: 'NPM_PASS', usernameVariable: 'NPM_USER')]) {
|
withCredentials([usernamePassword(credentialsId: 'NEXUS_CREDS', passwordVariable: 'NPM_PASS', usernameVariable: 'NPM_USER')]) {
|
||||||
script {
|
script {
|
||||||
@ -98,12 +84,7 @@ pipeline {
|
|||||||
|
|
||||||
post {
|
post {
|
||||||
success {
|
success {
|
||||||
script {
|
echo "Vue3 SDK v${env.PUBLISH_VERSION} 构建成功 (Commit: ${env.GIT_COMMIT_SHORT})"
|
||||||
echo "Vue3 SDK v${env.PUBLISH_VERSION} 构建成功 (Commit: ${env.GIT_COMMIT_SHORT})"
|
|
||||||
if (params.PUBLISH) {
|
|
||||||
echo "已发布到 Nexus npm 仓库: ${NEXUS_REGISTRY}"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
failure {
|
failure {
|
||||||
echo "Vue3 SDK 构建失败,请检查日志"
|
echo "Vue3 SDK 构建失败,请检查日志"
|
||||||
|
|||||||
正在加载...
在新工单中引用
屏蔽一个用户