diff --git a/Deploy/.gitignore b/Deploy/.gitignore index ff7379e6e..6ce98c244 100644 --- a/Deploy/.gitignore +++ b/Deploy/.gitignore @@ -2,9 +2,6 @@ -*.cmd *.dat -github-release-downloads.ps1 -PortableApps_Sums.ps1 - ConEmuPortable*.exe ConEmuPortableRarInfo.txt Portable_Test diff --git a/Deploy/PortableApps_Sums.ps1 b/Deploy/PortableApps_Sums.ps1 new file mode 100644 index 000000000..18f446dd7 --- /dev/null +++ b/Deploy/PortableApps_Sums.ps1 @@ -0,0 +1,22 @@ +param([String]$file) + +function CreateHash($path,$aname) +{ + $algo = [System.Security.Cryptography.HashAlgorithm]::Create($aname) + $stream = New-Object System.IO.FileStream($path, [System.IO.FileMode]::Open, [System.IO.FileAccess]::Read) + + $md5StringBuilder = New-Object System.Text.StringBuilder + $algo.ComputeHash($stream) | % { [void] $md5StringBuilder.Append($_.ToString("x2")) } + + $stream.Dispose() + + $md5StringBuilder.ToString() +} + +$fullPath = Resolve-Path $file + +$md5 = CreateHash -path $fullPath -aname "MD5" + +$f = Get-Item $fullPath + +Write-Host (Get-Item $file).Name (("{0:N1}" -f ($f.Length/(1024*1024)))+"MB "+$md5) diff --git a/Deploy/github-release-downloads.ps1 b/Deploy/github-release-downloads.ps1 new file mode 100644 index 000000000..08912e165 --- /dev/null +++ b/Deploy/github-release-downloads.ps1 @@ -0,0 +1,3 @@ +$rels = (conemuc -download https://api.github.com/repos/Maximus5/ConEmu/releases - 2>$null) +$rel = ConvertFrom-JSON $rels +$rel | foreach { Write-Host -NoNewLine "$($_.name): "; $total=0; $_.Assets | foreach { $total+=$_.download_count; Write-Host -NoNewLine " $($_.download_count)"}; Write-Host "; Total $total"; }; Write-Host "Done" diff --git a/Deploy/l10n_refresh.cmd b/Deploy/l10n_refresh.cmd new file mode 100644 index 000000000..2cde7a085 --- /dev/null +++ b/Deploy/l10n_refresh.cmd @@ -0,0 +1,61 @@ +@echo off + +setlocal + +if exist "%~dp0user_env.cmd" ( + call "%~dp0user_env.cmd" +) else ( + call "%~dp0user_env.default.cmd" +) + +call "%UPLOADERS%init_env.cmd" + +pushd "%~dp0.." + +set L10N_PATH=Release/ConEmu/ConEmu.l10n + +call "%PYTHON3%" "%~dp0l10n.py" --l10n %L10N_PATH% --tx-pull all --write-l10n +if errorlevel 1 ( + echo Failed to load updated translations from transifex + goto :err +) + +call "%GIT%" status --porcelain | %windir%\system32\find "%L10N_PATH%" +if errorlevel 1 ( + echo ConEmu.l10n was not updated + goto fin +) + +call "%~dp0GetCurVer.cmd" + +call "%GIT%" --no-pager diff %L10N_PATH% -new_console:cs50V + +echo Press Enter to create commit "l10n: translations were updated" +pause > nul + +call "%GIT%" reset +if errorlevel 1 ( + echo Git reset failed, l10n was not committed + goto :err +) +call "%GIT%" add %L10N_PATH% +if errorlevel 1 ( + echo Git add failed, l10n was not committed + goto :err +) +call "%GIT%" commit -m "l10n: translations were updated" +if errorlevel 1 ( + echo Git commit failed, l10n was not committed + goto :err +) + +goto fin + +:err +endlocal +popd +exit /b 1 + +:fin +endlocal +popd diff --git a/Deploy/release-downloads-json.cmd b/Deploy/release-downloads-json.cmd new file mode 100644 index 000000000..e9c18f9ba --- /dev/null +++ b/Deploy/release-downloads-json.cmd @@ -0,0 +1,3 @@ +@setlocal +@set dt=%date:~8,2%%date:~3,2%%date:~0,2% +@conemuc -download https://api.github.com/repos/Maximus5/ConEmu/releases "%~dp0downloads-%dt%.json" 2>nul diff --git a/Deploy/release-downloads.cmd b/Deploy/release-downloads.cmd new file mode 100644 index 000000000..a78588e13 --- /dev/null +++ b/Deploy/release-downloads.cmd @@ -0,0 +1,4 @@ +@setlocal +@set dt=%date:~8,2%%date:~3,2%%date:~0,2% +@powershell -noprofile -command "%~dp0github-release-downloads.ps1" > "%~dp0downloads-%dt%.txt" +@type "%~dp0downloads-%dt%.txt" diff --git a/Deploy/sign_any.sample.cmd b/Deploy/sign_any.sample.cmd new file mode 100644 index 000000000..8ed0d1934 --- /dev/null +++ b/Deploy/sign_any.sample.cmd @@ -0,0 +1,13 @@ +@echo off + +setlocal + +if exist "%~dp0user_env.cmd" ( + call "%~dp0user_env.cmd" +) else ( + call "%~dp0user_env.default.cmd" +) + +signtool sign /fd SHA256 %* + +endlocal diff --git a/Deploy/sign_release.cmd b/Deploy/sign_release.cmd new file mode 100644 index 000000000..6fc1713bf --- /dev/null +++ b/Deploy/sign_release.cmd @@ -0,0 +1,59 @@ +@echo off + +if not exist "%~dp0sign_any.cmd" ( + echo ********************************** + echo ********************************** + echo ** SKIPPING code signing ** + echo ********************************** + echo ********************************** + goto :EOF +) + +echo Signing code +if exist "%~1ConEmu\ConEmuC64.exe" set RELDIR=%~1&goto RelDirSet +set RELDIR=..\Release\ +:RelDirSet + + +set RELDIRCTH=%RELDIR%plugins\ConEmu\Thumbs + +set SIGFILES=%RELDIR%ConEmu.exe %RELDIR%ConEmu64.exe +set SIGFILES=%SIGFILES% %RELDIR%ConEmu\ConEmuC.exe %RELDIR%ConEmu\ConEmuC64.exe +set SIGFILES=%SIGFILES% %RELDIR%ConEmu\ConEmuCD.dll %RELDIR%ConEmu\ConEmuCD64.dll +set SIGFILES=%SIGFILES% %RELDIR%ConEmu\ConEmuHk.dll %RELDIR%ConEmu\ConEmuHk64.dll +set SIGFILES=%SIGFILES% %RELDIR%ConEmu\ExtendedConsole.dll %RELDIR%ConEmu\ExtendedConsole64.dll +set SIGFILES=%SIGFILES% %RELDIR%plugins\ConEmu\conemu.dll %RELDIR%plugins\ConEmu\Lines\ConEmuLn.dll +set SIGFILES=%SIGFILES% %RELDIRCTH%\ConEmuTh.dll %RELDIRCTH%\gdi+.t32 %RELDIRCTH%\ico.t32 %RELDIRCTH%\pe.t32 + +if "%~2"=="/NOSIGN64PLUG" goto skip_64 +set SIGFILES=%SIGFILES% %RELDIR%plugins\ConEmu\conemu.x64.dll %RELDIR%plugins\ConEmu\Lines\ConEmuLn.x64.dll +set SIGFILES=%SIGFILES% %RELDIRCTH%\ConEmuTh.x64.dll %RELDIRCTH%\gdi+.t64 %RELDIRCTH%\ico.t64 %RELDIRCTH%\pe.t64 +:skip_64 + +call :dosign %SIGFILES% +if errorlevel 1 goto failsign + +if "%TS"=="" ( + echo ********************************** + echo ********************************** + echo ** Binaries was NOT timestamped ** + echo ********************************** + echo ********************************** +) + +goto end + +:dosign +echo %* +call "%~dp0sign_any.cmd" %* +if errorlevel 1 goto :EOF +goto :EOF + + +:failsign +echo . +echo !!! Signing code failed !!! +echo . +pause + +:end diff --git a/Deploy/user_env.default.cmd b/Deploy/user_env.default.cmd new file mode 100644 index 000000000..caa35c5a9 --- /dev/null +++ b/Deploy/user_env.default.cmd @@ -0,0 +1,47 @@ +@if "%~1" == "-v" echo preparing environment + +@rem MSys2 breaks on 'TERM=msys' +@rem set TERM=msys +@set TERM= +@set LANG=en_US.UTF-8 + +@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 "%~dp0..\..\Tools\MSYS\msys2-x64\usr\bin\head.exe" set "MINGWRT=%~dp0..\..\Tools\MSYS\msys2-x64\usr\bin\" +@if exist "%~dp0..\..\..\..\tools\msys64\usr\bin\head.exe" set "MINGWRT=%~dp0..\..\..\..\tools\msys64\usr\bin\" +@if "%~1" == "-v" echo\ MINGWRT: '%MINGWRT%' + +@set CONEMU_WWW= +@if exist "%~dp0..\..\conemu.github.io\index.html" set "CONEMU_WWW=%~dp0..\..\conemu.github.io\" +@if exist "%~dp0..\..\ConEmu-GitHub-io\conemu.github.io\index.html" set "CONEMU_WWW=%~dp0..\..\ConEmu-GitHub-io\conemu.github.io\" +@if "%~1" == "-v" echo\ CONEMU_WWW: '%CONEMU_WWW%' + +@set CONEMU_DEPLOY= +@if exist "%~dp0..\..\conemu-deploy\foss.cmd" set "CONEMU_DEPLOY=%~dp0..\..\conemu-deploy\" +@if "%~1" == "-v" echo\ CONEMU_DEPLOY: '%CONEMU_DEPLOY%' + +@set UPLOADERS= +@if exist "%~dp0..\..\tools\Uploaders\Check-VirusTotal.cmd" set "UPLOADERS=%~dp0..\..\tools\Uploaders\" +@if "%~1" == "-v" echo\ UPLOADERS: '%UPLOADERS%' + +@set FARRUN_EXIST=NO +@farrun.exe -? 1> nul 2> nul +@if errorlevel 1 ( + set FARRUN_EXIST=NO +) else ( + set FARRUN_EXIST=YES +) +@if "%~1" == "-v" echo\ FARRUN_EXIST: '%FARRUN_EXIST%' + +@set GIT=git.exe +@if exist %~d0\gitsdk\cmd\git.exe set GIT=%~d0\gitsdk\cmd\git.exe +@if exist "C:\Program Files\Git\bin\git.exe" set "GIT=C:\Program Files\Git\bin\git.exe" +@if "%~1" == "-v" echo\ GIT: '%GIT%' + +@set PYTHON3=python3.exe +@if exist "%USERPROFILE%\AppData\Local\Programs\Python\Python37-32\python3.exe" set "PYTHON3=%USERPROFILE%\AppData\Local\Programs\Python\Python37-32\python3.exe" +@if "%~1" == "-v" echo\ PYTHON3: '%PYTHON3%' + +@set ZIP7=7z.exe +@if exist "%~dp0..\..\tools\Arch\7z.exe" set "ZIP7=%~dp0..\..\tools\Arch\7z.exe" +@if "%~1" == "-v" echo\ ZIP7: '%ZIP7%' diff --git a/Deploy_to_all.bat b/Deploy_to_all.bat new file mode 100644 index 000000000..7197f4182 --- /dev/null +++ b/Deploy_to_all.bat @@ -0,0 +1,192 @@ +@echo off + +setlocal + +call SetEscChar.cmd + +if exist "%~dp0Deploy\user_env.cmd" ( + call "%~dp0Deploy\user_env.cmd" +) else ( + call "%~dp0Deploy\user_env.default.cmd" +) +call "%GIT%" --version 1> nul 2> nul +if errorlevel 1 ( + call cecho "git not found, please configure user_env.cmd" + exit /b 1 +) + +cd /d "%~dp0" + +"%GIT%" log -5 --decorate=short --oneline +"%GIT%" status + +rem Returns env.var 'CurVerBuild' from version.h +call :getcurbuild + +echo . +echo . +set /P do_REL=%ESC%[1;31;40mCreate "%CurVerBuild% release files" commit [Y/n/q]: %ESC%[m +if /I "%do_REL%" == "q" exit /B 1 +set /P do_TAG=%ESC%[1;31;40mCreate "v%CurVerBuild:~0,2%.%CurVerBuild:~2,2%.%CurVerBuild:~4%" tag [Y/n/q]: %ESC%[m +if /I "%do_TAG%" == "q" exit /B 1 +set /P do_MST=%ESC%[1;31;40mMerge Daily branch into Master [Y/n/q]: %ESC%[m +if /I "%do_MST%" == "q" exit /B 1 +rem set /P do_MPV=%ESC%[1;31;40mMerge Daily branch into Preview [y/N/q]: %ESC%[m +rem if /I "%do_MPV%" == "q" exit /B 1 +set /P do_GHB=%ESC%[1;31;40mDeploy Branches to github^&sourgeforge [Y/n/q]: %ESC%[m +if /I "%do_GHB%" == "q" exit /B 1 +set /P do_GRL=%ESC%[1;31;40mDeploy Release to github [Y/n/q]: %ESC%[m +if /I "%do_GRL%" == "q" exit /B 1 +set /P do_CKL=%ESC%[1;31;40mDeploy Release to chocolatey [Y/n/q]: %ESC%[m +if /I "%do_CKL%" == "q" exit /B 1 +set /P do_NGT=%ESC%[1;31;40mDeploy Release to nuget [Y/n/q]: %ESC%[m +if /I "%do_NGT%" == "q" exit /B 1 +set /P do_FSH=%ESC%[1;31;40mDeploy Release to fosshub [Y/n/q]: %ESC%[m +if /I "%do_FSH%" == "q" exit /B 1 +set /P do_VER=%ESC%[1;31;40mBinaries [(A)lpha/(p)review/(pa)preview+alpha/(s)table/n/q]: %ESC%[m +if /I "%do_VER%" == "q" exit /B 1 + +echo .%ESC%[1;32;40m +pause +echo %ESC%[m. + + + + +if /I "%do_CKL%" == "N" goto skip_CHOCO1 +pushd "%~dp0nuget" +call cecho /yellow "Creating Chocolatey package" +call "%~dp0nuget\build.cmd" +if errorlevel 1 goto err +popd +:skip_CHOCO1 + +if /I "%do_NGT%" == "N" goto skip_NUGET1 +pushd "%~dp0nuget" +call cecho /yellow "Creating NuGet package" +call "%~dp0nuget\build.nuget-org.cmd" +if errorlevel 1 goto err +popd +:skip_NUGET1 + + + +if /I "%do_FSH%" == "N" goto skip_FOSS +pushd "%CONEMU_DEPLOY%" +call "%CONEMU_DEPLOY%foss.cmd" %CurVerBuild% +if errorlevel 1 goto err +popd +:skip_FOSS + + + +if /I "%do_REL%" == "N" goto skip_REL +"%GIT%" commit -am "%CurVerBuild% release files" +if errorlevel 1 goto err +:skip_REL + +if /I "%do_TAG%" == "N" goto skip_TAG +"%GIT%" tag v%CurVerBuild:~0,2%.%CurVerBuild:~2,2%.%CurVerBuild:~4% +if errorlevel 1 goto err +rem Move "v-preview" or "v-alpha" tag to the current location +if /I "%do_VER%" == "N" goto skip_TAG +"%GIT%" tag -f v-release +if /I "%do_VER%" == "S" ( + "%GIT%" tag -f v-stable +) else if /I "%do_VER%" == "P" ( + "%GIT%" tag -f v-preview +) else if /I "%do_VER%" == "PA" ( + "%GIT%" tag -f v-preview +) else ( + "%GIT%" tag -f v-alpha +) +rem Stable build is not available yet, so there is no v-stable tag +:skip_TAG + +rem if /I NOT "%do_MPV%" == "Y" goto skip_MPV +rem "%GIT%" checkout preview +rem if errorlevel 1 goto err +rem "%GIT%" merge daily +rem if errorlevel 1 goto err +:skip_MPV + +if /I "%do_MST%" == "N" goto skip_MST +"%GIT%" checkout master +if errorlevel 1 goto err +"%GIT%" merge daily +if errorlevel 1 goto err +"%GIT%" checkout daily +:skip_MST + +"%GIT%" log -5 --decorate=short --oneline + + + +rem \Utils\Lans\GIT\bin\git.exe branch +rem call cecho "Press enter to deploy `%CurVerBuild% Alpha` to github/sourgeforge" +rem pause + +if /I "%do_GHB%" == "N" goto skip_GHB +"%GIT%" push origin master daily +if errorlevel 1 goto err +"%GIT%" push -f origin --tags +if errorlevel 1 goto err +if /I "%do_GRL%" == "N" ( + echo Release creating skipped! +) else ( + echo Creating release: v%CurVerBuild:~0,2%.%CurVerBuild:~2,2%.%CurVerBuild:~4% %CurVerBuild% + call "%UPLOADERS%ConEmuGithubRelease.cmd" v%CurVerBuild:~0,2%.%CurVerBuild:~2,2%.%CurVerBuild:~4% %CurVerBuild% + if errorlevel 1 goto err +) +"%GIT%" push forge +:skip_GHB + + +if /I "%do_CKL%" == "N" goto skip_CHOCO2 +pushd "%~dp0nuget" +call cecho /yellow "Uploading Chocolatey package" +call "%~dp0nuget\upload.cmd" +if errorlevel 1 goto err +popd +:skip_CHOCO2 + +if /I "%do_NGT%" == "N" goto skip_NUGET2 +pushd "%~dp0nuget" +call cecho /yellow "Uploading NuGet package" +call "%~dp0nuget\upload.nuget-org.cmd" +if errorlevel 1 goto err +popd +:skip_NUGET2 + +if /I "%do_VER%" == "N" goto skip_AUTO +pushd "%CONEMU_DEPLOY%" +if /I "%do_VER%" == "S" ( +call "%CONEMU_DEPLOY%upld.cmd" %CurVerBuild% "Stable" +) else if /I "%do_VER%" == "P" ( +call "%CONEMU_DEPLOY%upld.cmd" %CurVerBuild% "Preview" +) else if /I "%do_VER%" == "PA" ( +call "%CONEMU_DEPLOY%upld.cmd" %CurVerBuild% "Preview+Alpha" +) else ( +call "%CONEMU_DEPLOY%upld.cmd" %CurVerBuild% "Alpha" +) +if errorlevel 1 goto err +popd +:skip_AUTO + +rem call cecho "Press enter to deploy `%CurVerBuild% Alpha` to googlecode/ConEmu-alpha" +rem pause + +rem if "%~1"=="" pause +goto :EOF + + +:getcurbuild +call "%~dp0Deploy\GetCurVer.cmd" +if "%CurVerBuild%" == "" ( +call cecho "Can't find valid version in src\ConEmu\version.h" +exit /B 100 +) +goto :EOF + +:err +pause