ci: remove all params, always run all stages, lock to main
这个提交包含在:
父节点
948ffdda16
当前提交
c291d36a86
31
Jenkinsfile
vendored
31
Jenkinsfile
vendored
@ -1,12 +1,6 @@
|
||||
pipeline {
|
||||
agent any
|
||||
|
||||
parameters {
|
||||
string(name: 'VERSION', defaultValue: '', description: '发布版本号(留空使用 oh-package.json5 中的 version)')
|
||||
booleanParam(name: 'RUN_TESTS', defaultValue: true, description: '是否运行测试')
|
||||
booleanParam(name: 'PUBLISH', defaultValue: false, description: '是否发布到 OHPM 仓库(需要配置 ohpm-credentials)')
|
||||
}
|
||||
|
||||
environment {
|
||||
OHPM_REGISTRY = 'https://ohpm.openharmony.cn/ohpm/'
|
||||
GIT_URL = 'https://xuqinmin.com/xuqmGroup/XuqmGroup-HarmonySDK.git'
|
||||
@ -29,9 +23,6 @@ pipeline {
|
||||
])
|
||||
script {
|
||||
env.GIT_COMMIT_SHORT = bat(script: '@git rev-parse --short HEAD', returnStdout: true).trim()
|
||||
if (params.VERSION?.trim()) {
|
||||
bat """powershell -Command "(Get-Content xuqm-sdk/oh-package.json5) -replace '\"version\": \"[^\"]*\"', '\"version\": \"${params.VERSION}\"' | Set-Content xuqm-sdk/oh-package.json5" """
|
||||
}
|
||||
env.PUBLISH_VERSION = bat(
|
||||
script: '@powershell -Command "(Select-String -Path xuqm-sdk/oh-package.json5 -Pattern \'version\').Line.Split(\'\\\"\')[3]"',
|
||||
returnStdout: true
|
||||
@ -42,7 +33,7 @@ pipeline {
|
||||
|
||||
stage('Build Info') {
|
||||
steps {
|
||||
echo "发布版本: ${env.PUBLISH_VERSION}"
|
||||
echo "发布版本: ${env.PUBLISH_VERSION} ⚠ 发布前请确认已在 oh-package.json5 中更新版本号"
|
||||
echo "Git Commit: ${env.GIT_COMMIT_SHORT}"
|
||||
}
|
||||
}
|
||||
@ -70,7 +61,6 @@ pipeline {
|
||||
}
|
||||
|
||||
stage('Run Tests') {
|
||||
when { expression { return params.RUN_TESTS } }
|
||||
steps {
|
||||
bat 'hvigorw test --no-daemon > test-results.txt 2>&1 || ver>nul'
|
||||
}
|
||||
@ -80,30 +70,11 @@ pipeline {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage('Publish to OHPM') {
|
||||
when {
|
||||
expression { return params.PUBLISH }
|
||||
}
|
||||
steps {
|
||||
withCredentials([usernamePassword(credentialsId: 'ohpm-credentials', passwordVariable: 'OHPM_PASS', usernameVariable: 'OHPM_USER')]) {
|
||||
bat """
|
||||
ohpm login -u %OHPM_USER% -p %OHPM_PASS% --registry %OHPM_REGISTRY%
|
||||
cd xuqm-sdk && ohpm publish --registry %OHPM_REGISTRY% > publish.log 2>&1 || ver>nul
|
||||
"""
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
post {
|
||||
success {
|
||||
script {
|
||||
echo "HarmonyOS SDK v${env.PUBLISH_VERSION} 构建成功 (Commit: ${env.GIT_COMMIT_SHORT})"
|
||||
if (params.PUBLISH) {
|
||||
echo "已发布到 OHPM 仓库: ${OHPM_REGISTRY}"
|
||||
}
|
||||
}
|
||||
}
|
||||
failure {
|
||||
echo "HarmonyOS SDK 构建失败,请检查日志"
|
||||
|
||||
正在加载...
在新工单中引用
屏蔽一个用户