Skip to content

Commit

Permalink
Internal. Add deploy scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
Maximus5 committed Jun 21, 2020
1 parent 9a8c28e commit 1615237
Show file tree
Hide file tree
Showing 10 changed files with 404 additions and 3 deletions.
3 changes: 0 additions & 3 deletions Deploy/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
-*.cmd
*.dat

github-release-downloads.ps1
PortableApps_Sums.ps1

ConEmuPortable*.exe
ConEmuPortableRarInfo.txt
Portable_Test
Expand Down
22 changes: 22 additions & 0 deletions Deploy/PortableApps_Sums.ps1
Original file line number Diff line number Diff line change
@@ -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)
3 changes: 3 additions & 0 deletions Deploy/github-release-downloads.ps1
Original file line number Diff line number Diff line change
@@ -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"
61 changes: 61 additions & 0 deletions Deploy/l10n_refresh.cmd
Original file line number Diff line number Diff line change
@@ -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
3 changes: 3 additions & 0 deletions Deploy/release-downloads-json.cmd
Original file line number Diff line number Diff line change
@@ -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
4 changes: 4 additions & 0 deletions Deploy/release-downloads.cmd
Original file line number Diff line number Diff line change
@@ -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"
13 changes: 13 additions & 0 deletions Deploy/sign_any.sample.cmd
Original file line number Diff line number Diff line change
@@ -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
59 changes: 59 additions & 0 deletions Deploy/sign_release.cmd
Original file line number Diff line number Diff line change
@@ -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
47 changes: 47 additions & 0 deletions Deploy/user_env.default.cmd
Original file line number Diff line number Diff line change
@@ -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%'
Loading

0 comments on commit 1615237

Please sign in to comment.