Skip to content

PreDeploy.ps1 for Ocotpus Deploy

Tobias Zürcher edited this page Nov 25, 2015 · 2 revisions

Add the following PreDeploy.ps1 to your package:

$transformer_exe = Resolve-Path "tools/transformer.exe"
$path = pwd | select -ExpandProperty Path

$args = @("transform", "--environment", $OctopusParameters["Octopus.Environment.Name"], "--path", $path, "--verbose", "--delete-templates")

if ([string]::IsNullOrEmpty($OctopusParameters["transformer.masterkey"]) -eq $false) {
		write-host "add password" 
		$args += "--password"
		$args += $OctopusParameters["transformer.masterkey"]
}

& $transformer_exe $args

# self destruction...
Remove-Item .transformer -Force -Recurse
Remove-Item tools -Force -Recurse

Include Transformer related files to the nuspec:

<file src="..\packages\Transformer.VisualStudio*\tools\*.dll" target="tools" />
<file src="..\packages\Transformer.VisualStudio*\tools\*.exe" target="tools" />
<file src="..\.transformer\" target=".transformer" />

Attention: for nuget pack you have to use -NoDefaultExcludes because the .transformer folder starts with a .!

Youse a variable named transformer.masterkey in Octopus Deploy to decrypt encrypted values.

Clone this wiki locally