提交jenkins自动化流水线

This commit is contained in:
Home
2026-03-29 03:17:58 +08:00
parent 8d8764e55d
commit 88ba24034e
2 changed files with 21 additions and 22 deletions
Vendored
+20 -22
View File
@@ -11,28 +11,6 @@ pipeline {
ANDROID_SDK = '/opt/android-sdk' // 安卓 SDK 路径
}
stages {
stage('读取 manifest 版本号(jq 稳定版)') {
steps {
script {
// 用 jq 读取(你最熟悉、最稳)
VERSION_NAME = sh(
script: "jq -r '.versionName' ./src/manifest.json",
returnStdout: true
).trim()
VERSION_CODE = sh(
script: "jq -r '.versionCode' ./src/manifest.json",
returnStdout: true
).trim()
echo "====================================="
echo " 版本名称:${VERSION_NAME}"
echo " 版本号:${VERSION_CODE}"
echo "====================================="
}
}
}
stage('打印环境变量') {
steps {
echo "使用的 UNIAPP_APP_ID${env.UNIAPP_APP_ID}"
@@ -57,6 +35,26 @@ pipeline {
echo "✅ 安装 UniApp 依赖(忽略平台+开权限+强制)"
sh "npm install --force --unsafe-perm --ignore-platform"
}
}
steps {
script {
VERSION_NAME = sh(
script: '''
node -p "require('json5').parse(require('fs').readFileSync('./src/manifest.json','utf8')).versionName"
''',
returnStdout: true
).trim()
VERSION_CODE = sh(
script: '''
node -p "require('json5').parse(require('fs').readFileSync('./src/manifest.json','utf8')).versionCode"
''',
returnStdout: true
).trim()
echo "版本名称:${VERSION_NAME}"
echo "版本号:${VERSION_CODE}"
}
}
stage('打包uniapp') {
steps {
+1
View File
@@ -58,6 +58,7 @@
"@dcloudio/uni-uts-v1": "3.0.0-4060620250520001",
"@dcloudio/vite-plugin-uni": "3.0.0-4060620250520001",
"@vue/runtime-core": "^3.4.21",
"json5": "^2.2.3",
"sass": "1.77.0",
"typescript": "^5.9.3",
"vite": "5.2.8"