@echo off
# 展示中文
chcp 65001
:projectFolder
set /p projectFolder="请输入工程的跟地址:"
if "%projectFolder%"=="" goto projectFolder
:staticFolder
set /p staticFolder="请输入工程生成的静态文件目录名称:"
if "%staticFolder%"=="" goto staticFolder
:env
set /p env="请输入当前工程打包环境:"
if "%env%"=="" goto env
:description
set /p description="请输入版本注释:"
if "%description%"=="" goto description
@echo "移除目录 [%projectFolder%\%staticFolder%\*]"
rmdir /s %projectFolder%\%staticFolder%\*
if %errorlevel% neq 0 goto error
@echo "移除目录./%staticFolder%/*下的版本控制"
git rm ./%staticFolder%/*
if %errorlevel% neq 0 goto error
@echo "提交"
git commit -m "在提交[%description%]之前移除旧的静态文件"
if %errorlevel% neq 0 goto error
git status
if %errorlevel% neq 0 goto error
npm run build:%env%
if %errorlevel% neq 0 goto error
git status
if %errorlevel% neq 0 goto error
git add ./%staticFolder%/*
if %errorlevel% neq 0 goto error
git commit -m "%description%"
if %errorlevel% neq 0 goto error
git push
@echo "上传成功!"
pause
exit
:error
pause
exit
网友评论