diff --git a/Scripts/Deploy-NewBuild.ps1 b/Scripts/Deploy-NewBuild.ps1 index a65e15785e45941a980bf1e3cda6578e58b0a516..8963a71659d7f89eaace54407bd5efbfdf50423a 100644 --- a/Scripts/Deploy-NewBuild.ps1 +++ b/Scripts/Deploy-NewBuild.ps1 @@ -1,6 +1,29 @@ -$UpdaterSettings = "C:\Tools\AutoTx-Updater\UpdaterConfig.inc.ps1" +# Helper script to facilitate the package-deploy-update cycle. Its purpose is to +# automate reading the updater config (optionally just using the default +# location) and subsequently call the `Make-Package.ps1` and +# `Provide-UpdaterPackage.ps1` scripts followed by a removal of the update +# marker file for the local computer, all using the parameters collected from +# the configuration file. -. $UpdaterSettings +[CmdletBinding()] +Param( + [String] $UpdaterSettings = "C:\Tools\AutoTx-Updater\UpdaterConfig.inc.ps1" +) + +$ErrorActionPreference = "Stop" + +try { + . $UpdaterSettings +} +catch { + $ex = $_.Exception.Message + Write-Host "Error reading settings file: '$($UpdaterSettings)' [$($ex)]" + Exit +} + +# Make sure to run from the directory containing the script itself: +$BaseDir = $(Split-Path $MyInvocation.MyCommand.Path) +Push-Location $BaseDir .\Make-Package.ps1 .\Provide-UpdaterPackage.ps1 -UpdaterSettings $UpdaterSettings @@ -8,4 +31,6 @@ $UpdaterSettings = "C:\Tools\AutoTx-Updater\UpdaterConfig.inc.ps1" $Marker = "$($UpdateSourcePath)\Service\UpdateMarkers\$($env:COMPUTERNAME)" if (Test-Path $Marker) { Remove-Item -Force -Verbose $Marker -} \ No newline at end of file +} + +Pop-Location \ No newline at end of file