美文网首页
Vue项目强制推送到git的bat脚本

Vue项目强制推送到git的bat脚本

作者: 吃竹子的程序熊 | 来源:发表于2020-03-16 20:43 被阅读0次
@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

相关文章

网友评论

      本文标题:Vue项目强制推送到git的bat脚本

      本文链接:https://www.haomeiwen.com/subject/zgboehtx.html