提交jenkins自动化流水线

This commit is contained in:
Home
2026-03-28 22:50:07 +08:00
parent 9f33f04e63
commit 9de25c9b35
Vendored
+12 -12
View File
@@ -3,26 +3,26 @@ pipeline {
tools {
nodejs 'node22'
}
environment {
UNIAPP_APP_ID = '__UNI__EDE0E52'
ANDROID_ASSETS_DIR = "android/app/src/main/assets/apps/${UNIAPP_APP_ID}/www"
}
stages {
stage('打印环境变量') {
stage('打印环境变量') {
steps {
echo "使用的凭据ID${env.BRANCH_NAME}"
echo "使用的 UNIAPP_APP_ID${env.UNIAPP_APP_ID}"
echo "安卓资源目录:${env.ANDROID_ASSETS_DIR}"
sh "node -v" // 打印 NodeJS 版本
sh "npm -v" // 打印 NPM 版本(可选)
}
}
stage('清理旧构建') {
steps {
sh '''
# 清理 uniapp 上次打包产物
rm -rf dist/
# 清理安卓构建缓存
rm -rf android/simpleDemo/build/
'''
sh "rm -rf dist/" // 清理 UniApp 打包生成的 dist 目录
sh "rm -rf android/simpleDemo/build/" // 清理 Android 项目构建缓存
sh "rm -rf ${ANDROID_ASSETS_DIR}" // 清理旧的 APP 资源文件目录
}
}
stage('安装依赖') {
steps {
sh 'npm install'