fix: update Jenkinsfile for Windows compatibility and xuqmGroup org

这个提交包含在:
XuqmGroup 2026-05-14 16:27:49 +08:00
父节点 d45c756473
当前提交 2f72e7a0f2

36
Jenkinsfile vendored
查看文件

@ -10,7 +10,7 @@ pipeline {
environment {
NEXUS_REGISTRY = 'https://nexus.xuqinmin.com/repository/npm-hosted/'
GIT_URL = 'https://xuqinmin.com/xuqinmin12/XuqmGroup-RNSDK.git'
GIT_URL = 'https://xuqinmin.com/xuqmGroup/XuqmGroup-RNSDK.git'
NODE_VERSION = '22'
}
@ -25,11 +25,11 @@ pipeline {
steps {
checkout scm
script {
env.GIT_COMMIT_SHORT = sh(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()) {
sh "npm version ${params.VERSION} --no-git-tag-version"
bat "npm version ${params.VERSION} --no-git-tag-version"
}
env.PUBLISH_VERSION = sh(script: 'node -p "require(\"./package.json\").version"', returnStdout: true).trim()
env.PUBLISH_VERSION = bat(script: 'node -p "require(\\"./package.json\\").version"', returnStdout: true).trim()
}
}
}
@ -37,29 +37,29 @@ pipeline {
stage('Build Info') {
steps {
script {
echo "🚀 构建分支: ${params.BRANCH}"
echo "🏷️ 发布版本: ${env.PUBLISH_VERSION}"
echo "🔨 Git Commit: ${env.GIT_COMMIT_SHORT}"
echo "构建分支: ${params.BRANCH}"
echo "发布版本: ${env.PUBLISH_VERSION}"
echo "Git Commit: ${env.GIT_COMMIT_SHORT}"
}
}
}
stage('Install Dependencies') {
steps {
sh 'npm ci'
bat 'npm ci'
}
}
stage('Type Check') {
steps {
sh 'npm run typecheck:all'
bat 'npm run typecheck:all'
}
}
stage('Tests') {
when { expression { return params.RUN_TESTS } }
steps {
sh 'npm test 2>&1 | tee test-results.txt || true'
bat 'npm test > test-results.txt 2>&1 || ver>nul'
}
post {
always {
@ -77,10 +77,10 @@ pipeline {
}
steps {
withCredentials([usernamePassword(credentialsId: 'nexus-npm-credentials', passwordVariable: 'NPM_PASS', usernameVariable: 'NPM_USER')]) {
sh """
npm config set registry ${NEXUS_REGISTRY}
echo "//nexus.xuqinmin.com/repository/npm-hosted/:_auth=\$(echo -n '\${NPM_USER}:\${NPM_PASS}' | base64)" > .npmrc
npm publish --workspaces --registry ${NEXUS_REGISTRY}
bat """
npm config set registry %NEXUS_REGISTRY%
echo //nexus.xuqinmin.com/repository/npm-hosted/:_auth=%NPM_USER%:%NPM_PASS% > .npmrc
npm publish --workspaces --registry %NEXUS_REGISTRY%
"""
}
}
@ -90,17 +90,17 @@ pipeline {
post {
success {
script {
echo "RN SDK v${env.PUBLISH_VERSION} 构建成功 (Commit: ${env.GIT_COMMIT_SHORT})"
echo "RN SDK v${env.PUBLISH_VERSION} 构建成功 (Commit: ${env.GIT_COMMIT_SHORT})"
if (params.PUBLISH) {
echo "📦 已发布到 Nexus npm 仓库: ${NEXUS_REGISTRY}"
echo "已发布到 Nexus npm 仓库: ${NEXUS_REGISTRY}"
}
}
}
failure {
echo "RN SDK 构建失败,请检查日志"
echo "RN SDK 构建失败,请检查日志"
}
always {
sh 'npm config delete registry 2>/dev/null || true'
bat 'npm config delete registry 2>nul || ver>nul'
}
}
}