Skip to content

Commit

Permalink
Improve deployment script (add file hash as sanity check).
Browse files Browse the repository at this point in the history
  • Loading branch information
metaprime committed May 9, 2017
1 parent 688e8f0 commit 40abb40
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion deploy.bat
Original file line number Diff line number Diff line change
@@ -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 changes: 16 additions & 0 deletions deploy.ps1
Original file line number Diff line number Diff line change
@@ -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?'
}

0 comments on commit 40abb40

Please sign in to comment.