#!/bin/bash

# 前端代码部署脚本，源码包用tar打包压缩成tgz
# Ver2.0.230512

# 压缩的源码包名字
PACKAGE_NAME=$1
# 项目名称，源码和部署存放目录用此命名
PROJECT_NAME=${2:-tmp}
# 源码包绝对路径
PACKAE_PATH=/data/src/${PROJECT_NAME}
# 部署目录绝对路径
WEB_ROOT_PATH=/data/nginx/html/${PROJECT_NAME}

# 部署前删除临时目录dist,部署目录下文件
rm -rf ${PACKAE_PATH}/dist
rm -rf ${WEB_ROOT_PATH}/*
# 解压源码包
tar xf ${PACKAE_PATH}/${PACKAGE_NAME} -C ${PACKAE_PATH}/
# 部署
/bin/mv -f ${PACKAE_PATH}/dist/* ${WEB_ROOT_PATH}/



