From 6ae2164d529c5f3a4c7547581d4c04e2af1f2786 Mon Sep 17 00:00:00 2001 From: kubbo <390378816@qq.com> Date: Wed, 21 Dec 2022 08:43:58 +0800 Subject: [PATCH] =?UTF-8?q?=E6=89=93=E5=8C=85=E8=84=9A=E6=9C=AC=E9=9B=86?= =?UTF-8?q?=E4=B8=AD=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- shell/move.sh | 22 ++++++++++++++++++++++ shell/update.sh | 13 +++++++++++++ src/rest/custom/getZip.js | 6 +++--- 3 files changed, 38 insertions(+), 3 deletions(-) create mode 100644 shell/move.sh create mode 100644 shell/update.sh diff --git a/shell/move.sh b/shell/move.sh new file mode 100644 index 0000000..90e8607 --- /dev/null +++ b/shell/move.sh @@ -0,0 +1,22 @@ +#!/bin/bash +Type=$1 +Prj=$2 +Deploy=$3 + +case "$Type" in + web) + cp -r $Prj/dist/* $Deploy + ;; + web) + cp -r $Prj/dist/build/h5/* $Deploy + ;; + web) + cp -r $Prj/dist/build/mp-weixin/* $Deploy + ;; + *) + echo $"Usage: $0 (web|wxwork|mp)" + exit 1 +esac + +exit $? +exit $RETVAL \ No newline at end of file diff --git a/shell/update.sh b/shell/update.sh new file mode 100644 index 0000000..5a78651 --- /dev/null +++ b/shell/update.sh @@ -0,0 +1,13 @@ +#!/usr/bin/expect + +set Name [lindex $argv 0] +set Prj [lindex $argv 1] +puts "更新$Name" +cd $Prj +spawn git pull +expect "Username" +send "aixianling\r" +expect "Password" +send "axl123.0\r" +interact +cd .. \ No newline at end of file diff --git a/src/rest/custom/getZip.js b/src/rest/custom/getZip.js index b369a87..de218c7 100644 --- a/src/rest/custom/getZip.js +++ b/src/rest/custom/getZip.js @@ -16,17 +16,17 @@ module.exports = { wxwork: 'base-wxcp', mp: 'dvcp_v2_wxmp' }[info.type] || {} - const path = `/home/deploy/node-service/${buildPath}`, + const path = `/home/deploy/node_deploy/${buildPath}`, {dist} = info Promise.all([ - execute(`/root/node-service/update.sh ${info.name} ${path}`), + execute(`./shell/update.sh ${info.name} ${path}`), db.query(sql) ]).then(() => setTimeout(() => { response.send({code: 0}) }, 1000)) execute(`cd ${path}&&npm run apps&&node bin/pages.js ${id}&&npm run build`) .then(() => fse.emptyDir(dist)) - .then(() => execute(`/root/node-service/move.sh ${info.type} ${path} ${dist}`)) + .then(() => execute(`./shell/move.sh ${info.type} ${path} ${dist}`)) .then(() => { return db.query(`update node_custom_config set download='${dayjs().format("YYYY-MM-DD HH:mm:ss")}',error='' where ${uniCon}`) }).catch(err => {