Skip to content

Instantly share code, notes, and snippets.

@blair55
Created January 28, 2014 00:09
Show Gist options
  • Save blair55/8659981 to your computer and use it in GitHub Desktop.
Save blair55/8659981 to your computer and use it in GitHub Desktop.
Decoupling your Web Deploy Build Script from Team City with Powershell
function Get-ScriptDirectory
{
$Invocation = (Get-Variable MyInvocation -Scope 1).Value
Split-Path $Invocation.MyCommand.Path
}
$targets = $env:TargetDeployUrls -split ","
foreach ($t in $targets)
{
$tt = $t.trim()
$path = Join-Path (Get-ScriptDirectory) fluid.card.web.deploy.cmd
Write-Host '-----------------------------------------'
Write-Host 'Start Deploy to' $tt
$args = @"
/y /M:$tt /u:$env:Username /p:$env:Password /A:Basic -allowUntrusted
" -setParam:name='LoggingEmailAddress',value='$env:LoggingEmailAddress' "
" -setParam:name='ServiceEndPoint',value='$env:ServiceEndPoint' "
"@
$cleanArgs = $args -replace "`n"," " -replace "`r"," "
$executable = $path + $cleanArgs
Write-Host 'Executable' $executable
iex $executable
Write-Host 'End Deploy to' $tt
Write-Host '-----------------------------------------'
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment