fix: update Jenkinsfile for Windows compatibility and xuqmGroup org
这个提交包含在:
父节点
d45c756473
当前提交
2f72e7a0f2
36
Jenkinsfile
vendored
36
Jenkinsfile
vendored
@ -10,7 +10,7 @@ pipeline {
|
|||||||
|
|
||||||
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/xuqinmin12/XuqmGroup-RNSDK.git'
|
GIT_URL = 'https://xuqinmin.com/xuqmGroup/XuqmGroup-RNSDK.git'
|
||||||
NODE_VERSION = '22'
|
NODE_VERSION = '22'
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -25,11 +25,11 @@ pipeline {
|
|||||||
steps {
|
steps {
|
||||||
checkout scm
|
checkout scm
|
||||||
script {
|
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()) {
|
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') {
|
stage('Build Info') {
|
||||||
steps {
|
steps {
|
||||||
script {
|
script {
|
||||||
echo "🚀 构建分支: ${params.BRANCH}"
|
echo "构建分支: ${params.BRANCH}"
|
||||||
echo "🏷️ 发布版本: ${env.PUBLISH_VERSION}"
|
echo "发布版本: ${env.PUBLISH_VERSION}"
|
||||||
echo "🔨 Git Commit: ${env.GIT_COMMIT_SHORT}"
|
echo "Git Commit: ${env.GIT_COMMIT_SHORT}"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
stage('Install Dependencies') {
|
stage('Install Dependencies') {
|
||||||
steps {
|
steps {
|
||||||
sh 'npm ci'
|
bat 'npm ci'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
stage('Type Check') {
|
stage('Type Check') {
|
||||||
steps {
|
steps {
|
||||||
sh 'npm run typecheck:all'
|
bat 'npm run typecheck:all'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
stage('Tests') {
|
stage('Tests') {
|
||||||
when { expression { return params.RUN_TESTS } }
|
when { expression { return params.RUN_TESTS } }
|
||||||
steps {
|
steps {
|
||||||
sh 'npm test 2>&1 | tee test-results.txt || true'
|
bat 'npm test > test-results.txt 2>&1 || ver>nul'
|
||||||
}
|
}
|
||||||
post {
|
post {
|
||||||
always {
|
always {
|
||||||
@ -77,10 +77,10 @@ pipeline {
|
|||||||
}
|
}
|
||||||
steps {
|
steps {
|
||||||
withCredentials([usernamePassword(credentialsId: 'nexus-npm-credentials', passwordVariable: 'NPM_PASS', usernameVariable: 'NPM_USER')]) {
|
withCredentials([usernamePassword(credentialsId: 'nexus-npm-credentials', passwordVariable: 'NPM_PASS', usernameVariable: 'NPM_USER')]) {
|
||||||
sh """
|
bat """
|
||||||
npm config set registry ${NEXUS_REGISTRY}
|
npm config set registry %NEXUS_REGISTRY%
|
||||||
echo "//nexus.xuqinmin.com/repository/npm-hosted/:_auth=\$(echo -n '\${NPM_USER}:\${NPM_PASS}' | base64)" > .npmrc
|
echo //nexus.xuqinmin.com/repository/npm-hosted/:_auth=%NPM_USER%:%NPM_PASS% > .npmrc
|
||||||
npm publish --workspaces --registry ${NEXUS_REGISTRY}
|
npm publish --workspaces --registry %NEXUS_REGISTRY%
|
||||||
"""
|
"""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -90,17 +90,17 @@ pipeline {
|
|||||||
post {
|
post {
|
||||||
success {
|
success {
|
||||||
script {
|
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) {
|
if (params.PUBLISH) {
|
||||||
echo "📦 已发布到 Nexus npm 仓库: ${NEXUS_REGISTRY}"
|
echo "已发布到 Nexus npm 仓库: ${NEXUS_REGISTRY}"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
failure {
|
failure {
|
||||||
echo "❌ RN SDK 构建失败,请检查日志"
|
echo "RN SDK 构建失败,请检查日志"
|
||||||
}
|
}
|
||||||
always {
|
always {
|
||||||
sh 'npm config delete registry 2>/dev/null || true'
|
bat 'npm config delete registry 2>nul || ver>nul'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
正在加载...
在新工单中引用
屏蔽一个用户