Parcourir la source

feat(jenkins): upd

zengzhixiang il y a 2 ans
Parent
commit
2074143169
1 fichiers modifiés avec 11 ajouts et 6 suppressions
  1. 11 6
      Jenkinsfile

+ 11 - 6
Jenkinsfile

@@ -27,21 +27,26 @@ pipeline {
           // sh 'nvm install v16'
           // sh 'nvm use v16'
           sh '''
-                node -v
-                npm -v
-                npm install
+            node -v
+            npm -v
+            npm install
           '''
         }
       }
     }
     stage('构建项目') {
       steps {
+        when {
+          branch 'feature/jenkinsfile'
+        }
         nodejs('v16'){
           sh '''
-            if [ "${BRANCH_NAME}" == "feature/jenkinsfile" ]; then
-              npm run build:test
-            elif [ "${BRANCH_NAME}" == "feature/jenkinsfile2" ]; then
+            if [ "${BRANCH_NAME}" == "master" ]; then
+              npm run build:prod
+            elif [ "${BRANCH_NAME}" == "uat" ]; then
               npm run build:uat
+            else
+              npm run build:test
             fi
           '''
         }