forked from Maximus5/ConEmu
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CreateRelease.cmd
211 lines (165 loc) · 4.74 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
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
@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
if exist "%~dp0Deploy\user_env.cmd" (
call "%~dp0Deploy\user_env.cmd"
) else (
call "%~dp0Deploy\user_env.default.cmd"
)
if not exist "%MINGWRT%head.exe" (
echo head.exe tool not found, exiting
exit /b 1
)
if not exist "%CONEMU_WWW%index.html" (
echo conemu.github.io sources not found, exiting
exit /b 1
)
set BUILD_NO=
set BUILD_STAGE=
if "%~1"=="" goto noparm
:loop_param
if /I "%~1" == "ALPHA" (
set BUILD_STAGE=ALPHA
shift /1
) else if /I "%~1" == "PREVIEW" (
set BUILD_STAGE=PREVIEW
shift /1
) else if /I "%~1" == "STABLE" (
set BUILD_STAGE=STABLE
shift /1
) else if /I "%~1" == "SIGN" (
shift /1
goto do_sign
) else (
set BUILD_NO=%~1
shift /1
)
if "%~1" NEQ "" goto loop_param
: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 Download new translations from Transifex
call "%~dp0Deploy\l10n_refresh.cmd"
rem This will create ".daily.md"
call "%~dp0Deploy\git2log.cmd" -skip_upd
call :edit -e5 "%CONEMU_WWW%_posts\.daily.md"
call :edit -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
:do_sign
rem Sign code
call "%~dp0src\vc.build.release.cmd" dosign
if errorlevel 1 goto err
if exist "%UPLOADERS%Check-VirusTotal.cmd" (
pushd "%~dp0Release"
echo Starting Check-VirusTotal
call cmd /c "%UPLOADERS%Check-VirusTotal.cmd" -new_console:bc
popd
) else (
echo Check-VirusTotal script not found
)
if exist "%~dp0..\Deploy\av_scan_release.cmd" (
Echo Scanning release files with av engine
call "%~dp0..\Deploy\av_scan_release.cmd"
)
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
:edit
if "%FARRUN_EXIST%" == "NO" (
start notepad.exe %2
goto :EOF
)
farrun -new_console:b %1 %2
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