Improve deployment script (add file hash as sanity check).

This commit is contained in:
MetaPrime 2017-05-09 11:59:16 -07:00
parent 688e8f0e13
commit 40abb405e9
2 changed files with 17 additions and 1 deletions

View File

@ -1,2 +1,2 @@
@echo off
xcopy /s/e/y target\*.jar %~dp0\ripme.jar
powershell -c ".\deploy.ps1 -source (Join-Path target (Get-Item -Path .\target\* -Filter *.jar)[0].Name) -dest ripme.jar"

16
deploy.ps1 Normal file
View File

@ -0,0 +1,16 @@
Param (
[Parameter(Mandatory=$True)]
[string]$source,
[Parameter(Mandatory=$True)]
[string]$dest
)
Copy-Item -Path $source -Destination $dest
$sourceHash = (Get-FileHash $source -algorithm MD5).Hash
$destHash = (Get-FileHash $dest -algorithm MD5).Hash
if ($sourceHash -eq $destHash) {
Write-Output 'Deployed successfully.'
} else {
Write-Output 'Hash Mismatch: did you close ripme before deploying?'
}