#!/bin/bash

# 仓库源
ADDREES="http://39.106.216.189:6018"
# 仓库地址
REPOT="$ADDREES/FE/products-static.git"
# 打包后文件目录
DIST="./build/*"
# 部署分支
DEPLOY_BRANCH="saturn-minio-console"

echo "仓库地址 -> $REPOT"
echo "分支 -> build_deploy"

echo "拉取部署仓库"
git clone -b $DEPLOY_BRANCH $REPOT ./build_deploy
echo "进入部署仓库"
cd ./build_deploy

echo '清空历史文件'
git rm * -f -r
git add .
git commit -m 'clear'
echo "清空提交完成"

echo "提交新的部署包"
cd ../
cp -r $DIST ./build_deploy
cd ./build_deploy
git add .
git commit -m "deploy"
git push origin $DEPLOY_BRANCH

echo "发布完成, 可以使用下方命令拉取 👇🏻 "
echo "git clone -b ${DEPLOY_BRANCH} ${REPOT}"
