你还在手动发布代码吗?累不?

2014年12月5日15:37:37 
注意:值得一提的是此工具的运行环境,
1,需要在你的服务器上安装svn。
2,需要安装相应的vs编译器,如果你觉得太大,你可以选择安装相对于的window sdk for .net framework


1、Auto_Build_EAS.bat

@echo off 

@echo -------------------------
@echo Only change variables below
set MSBuildDir=%WINDIR%\Microsoft.NET\Framework\v3.5
set BuildType=Release
set WorkingSpace=D:\workingspace\projects\shgt_erp\trunk
set SourceDir=%WorkingSpace%\02-Sources
set SolutionDir=%SourceDir%\N-EAS
set SolutionPath=%SolutionDir%\NI.EAS.All.sln
set BinOutput=BinOutput

rem cd to the folder of this command
pushd %~dp0

@echo -------------------------
@echo Start to get latest and build NI.EAS.All solution

@echo Remove old log files
del logs\ /Q /S /F

@echo -------------------------
@echo Get Lastest for %WorkingSpace%
svn update %WorkingSpace%
@echo Get Lastest Finished
@echo -------------------------

@echo Clear BinOutput
del %SolutionDir%\%BinOutput%\ /Q /S /F
@echo Clear Binoutput Finished
@echo -------------------------

@echo Building Start

call %MSBuildDir%\msbuild %SolutionPath% /t:Rebuild /p:Configuration=%BuildType% >> logs\NI.EAS.log

@echo Building Finsihed
@echo -------------------------

find "0 Error(s)" logs\NI.EAS.log && echo "no error" > logs\no_error.txt

if exist logs\no_error.txt (goto succeed) else (goto failed)

:succeed

call Deploy.bat %SolutionDir%

call Deploy_Jobs.bat %SourceDir% %BuildType%

echo deploy succeed

pause
exit

:failed
echo deploy failed

pause
exit

----------------------------------------------------------------------------
2、Deploy.bat

set SolutionDir=%1

set DestDir=D:\EAS

set ServiceDir=%SolutionDir%\Service
set ServiceDestDir=%DestDir%\Service

set PortalDir=%SolutionDir%\Portal\NI.EAS.Presentation.Web
set PortalDestDir=%DestDir%\NI.EAS.Presentation.Web

set APIDir=%SolutionDir%\Portal\NI.EAS.Presentation.API
set APIDestDir=%DestDir%\NI.EAS.Presentation.API


@echo Backup the latest version
del bak\ /Q /S /F
xcopy %DestDir%\*.* bak\ /S /Y /exclude:skipFiles.txt


@echo Copy to destination

net stop w3svc

xcopy %ServiceDir%\*.* %ServiceDestDir%\ /S /D /Y /exclude:skipFiles.txt
xcopy %PortalDir%\*.* %PortalDestDir%\ /S /D /Y /exclude:skipFiles.txt
xcopy %APIDir%\*.* %APIDestDir%\ /S /D /Y /exclude:skipFiles.txt

net start w3svc
iisreset /restart

----------------------------------------------------------------------------
3、Auto_Build_Jobs.bat
@echo off 

@echo -------------------------
@echo Only change variables below
set MSBuildDir=%WINDIR%\Microsoft.NET\Framework\v3.5
set BuildType=Release
set WorkingSpace=D:\workingspace\projects\shgt_erp\trunk
set SourceDir=%WorkingSpace%\02-Sources
set SolutionDir=%SourceDir%\N-EAS
set SolutionPath=%SolutionDir%\NI.EAS.All.sln
set BinOutput=BinOutput

rem cd to the folder of this command
pushd %~dp0

@echo -------------------------
@echo Start to get latest and build NI.EAS.All solution

@echo Remove old log files
del logs\ /Q /S /F

@echo -------------------------
@echo Get Lastest for %WorkingSpace%
svn update %WorkingSpace%
@echo Get Lastest Finished
@echo -------------------------

@echo Clear BinOutput
del %SolutionDir%\%BinOutput%\ /Q /S /F
@echo Clear Binoutput Finished
@echo -------------------------

@echo Building Start

call %MSBuildDir%\msbuild %SolutionPath% /t:Rebuild /p:Configuration=%BuildType% >> logs\NI.EAS.log

@echo Building Finsihed
@echo -------------------------

find "0 Error(s)" logs\NI.EAS.log && echo "no error" > logs\no_error.txt

if exist logs\no_error.txt (goto succeed) else (goto failed)

:succeed
call Deploy_Jobs.bat %SourceDir% %BuildType%

echo compile succeed

pause
exit

:failed
echo compile failed

pause
exit

------------------------------------------------------------------------------
4.Deploy_Jobs.bat

set SourceDir=%1
set BuildType=%2

set FinancialJobDir=%SourceDir%\AutoInterfaceTask\InterfaceTask\TaskService\bin\%BuildType%
set ScheduleJobDir=%SourceDir%\N-EAS\Jobs\NI.EAS.Jobs\bin\%BuildType%

set FinancialJobDestDir=D:\ServiceRun\Debug
set ScheduleJobDestDir=D:\Scheduler\bin\Release


@echo Backup the latest version
del bak_jobs\ /Q /S /F
xcopy %FinancialJobDestDir%\*.* bak_jobs\ServiceRun\ /S /Y /exclude:skipFiles.txt
xcopy %ScheduleJobDestDir%\*.* bak_jobs\Scheduler\ /S /Y /exclude:skipFiles.txt

@echo Copy to destination

rem net stop Finance

rem xcopy %FinancialJobDir%\*.* %FinancialJobDestDir%\ /S /D /Y /exclude:skipFiles.txt

rem net start Finance


net stop ERPSchedluer

xcopy %ScheduleJobDir%\*.* %ScheduleJobDestDir%\ /S /D /Y /exclude:skipFiles.txt

net start ERPSchedluer


转载于:https://my.oschina.net/908Sharp/blog/301463

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值