forked from Maximus5/ConEmu
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCreateRelease.cmd
178 lines (136 loc) · 4.31 KB
/
CreateRelease.cmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
@echo off
setlocal
set ver_info="%~dp0PortableApps\App\AppInfo\appinfo.ini"
set ver_hdr="%~dp0src\ConEmu\version.h"
rem Set curdt variable to YYMMDD
call "%~dp0Deploy\GetCurDate.cmd"
set ConEmuHooks=Enabled
rem set PATH=%PATH%
set MINGWRT=
if exist %~d0\MinGW\msys\1.0\bin\head.exe set MINGWRT=%~d0\MinGW\msys\1.0\bin
if exist %~d0\MinGW\msys32\bin\head.exe set MINGWRT=%~d0\MinGW\msys32\bin
if exist %~d0..\Tools\MSYS\msys2-x64\usr\bin\head.exe set MINGWRT=%~d0..\Tools\MSYS\msys2-x64\usr\bin
set BUILD_NO=
set BUILD_STAGE=
if "%~1"=="" goto noparm
set BUILD_NO=%~1
if /I "%~2" == "ALPHA" (
set BUILD_STAGE=ALPHA
shift /2
) else if /I "%~2" == "PREVIEW" (
set BUILD_STAGE=PREVIEW
shift /2
) else if /I "%~2" == "STABLE" (
set BUILD_STAGE=STABLE
shift /2
)
:oneparm
rem check date, must not bee too late or future ;)
set /A maxdt=%curdt%+1
set /A mindt=%curdt%-1
if "%BUILD_NO:~0,6%" == "%curdt%" goto buildok
if "%BUILD_NO:~0,6%" == "%maxdt%" goto buildok
if "%BUILD_NO:~0,6%" == "%mindt%" goto buildok
echo [1;31;40m------- Warning -------[0m
echo [1;31;40mCheck your build number[0m
echo [1;31;40m Build: %BUILD_NO% [0m
echo [1;31;40m Today: %curdt% [0m
echo [1;31;40m------- Warning -------[0m
pause
:buildok
call "%~dp0\src\ConEmu\gen_version.cmd" %BUILD_NO% %BUILD_STAGE%
if errorlevel 1 goto err
rem This will create ".daily.md"
call "%~dp0Deploy\git2log.cmd" -skip_upd
farrun -new_console:b -e5 "%~dp0..\ConEmu-GitHub-io\ConEmu.github.io\_posts\.daily.md"
farrun -new_console:b -e23 "%~dp0Release\ConEmu\WhatsNew-ConEmu.txt"
if /I "%~2" == "-build" goto do_build
if /I "%~2" == "-deploy" goto do_deploy
rem echo on
rem Update versions in all release files (msi, portableapps, nuget, etc.)
powershell -noprofile -command "%~dp0Deploy\UpdateDeployVersions.ps1" %BUILD_NO%
if errorlevel 1 goto err
rem set ConEmuHooks=OFF
echo [93;40mVersion from WhatsNew-ConEmu.txt[0m
%MINGWRT%\head -n 30 "%~dp0Release\ConEmu\WhatsNew-ConEmu.txt" | %windir%\system32\find "20%BUILD_NO:~0,2%.%BUILD_NO:~2,2%.%BUILD_NO:~4,2%"
if errorlevel 1 (
%MINGWRT%\head -n 30 "%~dp0Release\ConEmu\WhatsNew-ConEmu.txt" | %MINGWRT%\tail -n -16
echo/
echo [1;31;40mBuild number was not described in WhatsNew-ConEmu.txt![0m
echo/
)
echo [93;40mVersion from PortableApps[0m
type %ver_info% | %MINGWRT%\grep -E "^(PackageVersion|DisplayVersion)"
echo [93;40mVersion from version.h[0m
type %ver_hdr% | %MINGWRT%\grep -G "^#define MVV_"
rem Don't wait for confirmation - build number was already confirmed...
rem echo/
rem echo Press Enter to continue if version is OK: "%BUILD_NO%"
rem pause>nul
rem Give a time to editors to be started
rem timeout /t 15
echo Press Enter to start build
pause > nul
:do_build
cd /d "%~dp0src"
rem touch
rem call :tch common *.cpp *.hpp *.h
rem call :tch ConEmu *.cpp *.h
rem call :tch ConEmuBg *.cpp *.h
rem call :tch ConEmuC *.cpp *.h
rem call :tch ConEmuCD *.cpp *.h
rem call :tch ConEmuDW *.cpp *.h
rem call :tch ConEmuHk *.cpp *.h
rem call :tch ConEmuLn *.cpp *.h
rem call :tch ConEmuPlugin *.cpp *.h
rem call :tch ConEmuTh *.cpp *.h
echo Removing intermediate files...
rd /S /Q "%~dp0src\_VCBUILD\Release"
rem Compile x86/x64
call "%~dp0src\ms.build.release.cmd"
if errorlevel 1 goto err
rem Sign code
call "%~dp0src\vc.build.release.cmd" dosign
if errorlevel 1 goto err
if exist "%~dp0..\..\Google\Check-VirusTotal.cmd" (
pushd "%~dp0Release"
echo Starting Check-VirusTotal
call cmd /c "%~dp0..\..\Google\Check-VirusTotal.cmd" -new_console:bc
popd
) else (
echo Check-VirusTotal script not found
)
if exist "%~dp0Release\UnitTests.cmd" call "%~dp0Release\UnitTests.cmd"
:do_deploy
cd /d "%~dp0"
call Deploy\Deploy.cmd %BUILD_NO%
goto fin
:tch
cd %1
%MINGWRT%\touch %2 %3 %4
cd ..
goto :EOF
:noparm
call "%~dp0Deploy\GetCurVer.cmd"
if "%CurVerBuild%" NEQ "" goto build_found
set CurVerBuild=%curdt%
:build_found
echo Usage: CreateRelease.cmd ^<Version^> [^<Stage^>]
echo Example: CreateRelease.cmd %CurVerBuild% %CurVerStage%
echo/
set CurVerBuild=%curdt%
set BUILD_NO=
set BUILD_STAGE=
rem Version
set /P BUILD_NO="Deploy build number [%CurVerBuild%]: "
if "%BUILD_NO%" == "" set "BUILD_NO=%CurVerBuild%"
rem Version stage
set /P BUILD_STAGE="Build stage [%CurVerStage%]: "
if "%BUILD_STAGE%" == "" set "BUILD_STAGE=%CurVerStage%"
echo.
if NOT "%BUILD_NO%"=="" goto oneparm
goto fin
:err
Echo Deploy FAILED!!!
:fin
pause