Updated publish script
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
# Hard-coded deploy settings. Fill these in before running.
|
||||
$FtpHost = "xTr1m.com"
|
||||
$FtpUser = "xTr1m"
|
||||
$FtpPassword = $null # prompted at runtime
|
||||
$Password = $null # prompted at runtime
|
||||
$RemoteDir = "/httpdocs/picknplay"
|
||||
$ProjectPath = "..\\GameList.csproj"
|
||||
$Configuration = "Release"
|
||||
@@ -13,7 +13,6 @@ $RecycleAppPool = $true
|
||||
$AppPoolName = "xTr1m.com(domain)(4.0)(pool)"
|
||||
$WinRmComputer = "xTr1m.com"
|
||||
$WinRmCredentialUser = "Administrator"
|
||||
$WinRmCredentialPass = $null # prompted at runtime
|
||||
$UseWinRmHttps = $true # set false if using HTTP + TrustedHosts
|
||||
|
||||
<#!
|
||||
@@ -60,9 +59,8 @@ function Read-PlainOrPrompt([object]$Value, [string]$Prompt, [bool]$Secure = $fa
|
||||
return Read-Host -Prompt $Prompt
|
||||
}
|
||||
|
||||
$FtpPassword = Read-PlainOrPrompt $FtpPassword "FTP password" $true
|
||||
$WinRmCredentialPass = Read-PlainOrPrompt $WinRmCredentialPass "WinRM password" $true
|
||||
$WinRmAuth = "Basic" # Basic for local admin over HTTPS; use Default/Kerberos if joined to domain
|
||||
$Password = Read-PlainOrPrompt $Password "Password" $true
|
||||
$WinRmAuth = "Basic" # Basic for local admin over HTTPS; use Default/Kerberos if joined to domain
|
||||
|
||||
Write-Host "1) Publishing..." -ForegroundColor Cyan
|
||||
if (Test-Path $PublishDir) { Remove-Item $PublishDir -Recurse -Force -ErrorAction SilentlyContinue }
|
||||
@@ -73,7 +71,7 @@ dotnet @publishArgs
|
||||
|
||||
if ($RecycleAppPool) {
|
||||
Write-Host "2) Stopping IIS app pool via WinRM..." -ForegroundColor Cyan
|
||||
$sec = ConvertTo-SecureString $WinRmCredentialPass -AsPlainText -Force
|
||||
$sec = ConvertTo-SecureString $Password -AsPlainText -Force
|
||||
$cred = New-Object pscredential($WinRmCredentialUser, $sec)
|
||||
$invokeParams = @{
|
||||
ComputerName = $WinRmComputer
|
||||
@@ -97,7 +95,7 @@ $tempScript = New-TemporaryFile
|
||||
@"
|
||||
option batch continue
|
||||
option confirm off
|
||||
open ftp://$($FtpUser):$($FtpPassword.Replace('`n','').Replace('`r',''))@$FtpHost
|
||||
open ftp://$($FtpUser):$($Password.Replace('`n','').Replace('`r',''))@$FtpHost
|
||||
lcd $PublishDir
|
||||
cd $RemoteDir
|
||||
synchronize remote . -delete -filemask="|web.config"
|
||||
@@ -109,7 +107,7 @@ Remove-Item $tempScript -ErrorAction SilentlyContinue
|
||||
|
||||
if ($RecycleAppPool) {
|
||||
Write-Host "4) Starting IIS app pool via WinRM..." -ForegroundColor Cyan
|
||||
$sec = ConvertTo-SecureString $WinRmCredentialPass -AsPlainText -Force
|
||||
$sec = ConvertTo-SecureString $Password -AsPlainText -Force
|
||||
$cred = New-Object pscredential($WinRmCredentialUser, $sec)
|
||||
$invokeParams = @{
|
||||
ComputerName = $WinRmComputer
|
||||
|
||||
Reference in New Issue
Block a user