Skip to content
This repository was archived by the owner on Jun 30, 2022. It is now read-only.

Commit 1e21a1d

Browse files
committed
Update deployment scripts
1 parent 4987209 commit 1e21a1d

File tree

24 files changed

+132
-85
lines changed
  • samples/assistants
    • EnterpriseNotification/VirtualAssistant/Deployment/Scripts
    • HospitalitySample/Deployment/Scripts
  • skills/src/csharp
  • templates
    • Skill-Template/csharp
    • Virtual-Assistant-Template
      • csharp
      • typescript
        • generator-botbuilder-assistant/generators
          • app/templates/sample-assistant/deployment/scripts
          • skill/templates/sample-skill/deployment/scripts
        • samples

24 files changed

+132
-85
lines changed

samples/assistants/EnterpriseNotification/VirtualAssistant/Deployment/Scripts/publish.ps1

Lines changed: 37 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,18 @@ Param(
44
[string] $name,
55
[string] $resourceGroup,
66
[string] $projFolder = $(Get-Location),
7-
[string] $logFile = $(Join-Path $PSScriptRoot .. "publish.txt")
7+
[string] $logFile = $(Join-Path $PSScriptRoot .. "publish_log.txt")
88
)
99

10+
# Get mandatory parameters
11+
if (-not $name) {
12+
$name = Read-Host "? Bot Web App Name"
13+
}
14+
15+
if (-not $resourceGroup) {
16+
$resourceGroup = Read-Host "? Bot Resource Group"
17+
}
18+
1019
# Reset log file
1120
if (Test-Path $logFile) {
1221
Clear-Content $logFile -Force | Out-Null
@@ -24,7 +33,7 @@ if (-not (Test-Path (Join-Path $projFolder '.deployment'))) {
2433
| Select-Object -First 1
2534

2635
# Add needed deployment files for az
27-
az bot prepare-deploy --lang Csharp --code-dir $projFolder --proj-file-path $projFile.name
36+
az bot prepare-deploy --lang Csharp --code-dir $projFolder --proj-file-path $projFile.name --output json | Out-Null
2837
}
2938

3039
# Delete src zip, if it exists
@@ -33,12 +42,30 @@ if (Test-Path $zipPath) {
3342
Remove-Item $zipPath -Force | Out-Null
3443
}
3544

36-
# Compress source code
37-
Get-ChildItem -Path "$($projFolder)" | Compress-Archive -DestinationPath "$($zipPath)" -Force | Out-Null
45+
# Perform dotnet publish step ahead of zipping up
46+
$publishFolder = $(Join-Path $projFolder 'bin\Release\netcoreapp2.2')
47+
dotnet publish -c release -o $publishFolder -v q > $logFile
48+
49+
if($?) {
50+
# Compress source code
51+
Get-ChildItem -Path "$($publishFolder)" | Compress-Archive -DestinationPath "$($zipPath)" -Force | Out-Null
3852

39-
# Publish zip to Azure
40-
Write-Host "> Publishing to Azure ..."
41-
(az webapp deployment source config-zip `
42-
--resource-group $resourceGroup `
43-
--name $name `
44-
--src $zipPath) 2>> $logFile | Out-Null
53+
# Publish zip to Azure
54+
Write-Host "> Publishing to Azure ..." -ForegroundColor Green
55+
Invoke-Expression "az webapp deployment source config-zip --resource-group $($resourceGroup) --name $($name) --src $($zipPath) --output json" -ErrorVariable publishError -OutVariable publishOutput 2>&1 | Out-Null
56+
Add-Content $logFile $publishOutput | Out-Null
57+
Add-Content $logFile $publishError | Out-Null
58+
59+
$err = $publishError | Where { $_.Exception.ErrorRecord -like "*ERROR*" }
60+
61+
if ($err)
62+
{
63+
Write-Host "! Could not deploy automatically to Azure. Review the log for more information." -ForegroundColor DarkRed
64+
Write-Host "! Error: $($err.Exception.ErrorRecord)" -ForegroundColor DarkRed
65+
Write-Host "! Log: $($logFile)" -ForegroundColor DarkRed
66+
}
67+
}
68+
else {
69+
Write-Host "! Could not deploy automatically to Azure. Review the log for more information." -ForegroundColor DarkRed
70+
Write-Host "! Log: $($logFile)" -ForegroundColor DarkRed
71+
}

samples/assistants/HospitalitySample/Deployment/Scripts/publish.ps1

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -46,21 +46,26 @@ if (Test-Path $zipPath) {
4646
$publishFolder = $(Join-Path $projFolder 'bin\Release\netcoreapp2.2')
4747
dotnet publish -c release -o $publishFolder -v q > $logFile
4848

49-
if($?)
50-
{
51-
# Compress source code
52-
Get-ChildItem -Path "$($publishFolder)" | Compress-Archive -DestinationPath "$($zipPath)" -Force | Out-Null
49+
if($?) {
50+
# Compress source code
51+
Get-ChildItem -Path "$($publishFolder)" | Compress-Archive -DestinationPath "$($zipPath)" -Force | Out-Null
5352

54-
# Publish zip to Azure
55-
Write-Host "> Publishing to Azure ..." -ForegroundColor Green
56-
(az webapp deployment source config-zip `
57-
--resource-group $resourceGroup `
58-
--name $name `
59-
--src $zipPath `
60-
--output json) 2>> $logFile | Out-Null
61-
}
62-
else
63-
{
53+
# Publish zip to Azure
54+
Write-Host "> Publishing to Azure ..." -ForegroundColor Green
55+
Invoke-Expression "az webapp deployment source config-zip --resource-group $($resourceGroup) --name $($name) --src $($zipPath) --output json" -ErrorVariable publishError -OutVariable publishOutput 2>&1 | Out-Null
56+
Add-Content $logFile $publishOutput | Out-Null
57+
Add-Content $logFile $publishError | Out-Null
58+
59+
$err = $publishError | Where { $_.Exception.ErrorRecord -like "*ERROR*" }
60+
61+
if ($err)
62+
{
63+
Write-Host "! Could not deploy automatically to Azure. Review the log for more information." -ForegroundColor DarkRed
64+
Write-Host "! Error: $($err.Exception.ErrorRecord)" -ForegroundColor DarkRed
65+
Write-Host "! Log: $($logFile)" -ForegroundColor DarkRed
66+
}
67+
}
68+
else {
6469
Write-Host "! Could not deploy automatically to Azure. Review the log for more information." -ForegroundColor DarkRed
65-
Write-Host "! Log: $($logFile)" -ForegroundColor DarkRed
66-
}
70+
Write-Host "! Log: $($logFile)" -ForegroundColor DarkRed
71+
}

skills/src/csharp/automotiveskill/automotiveskill/Deployment/Scripts/publish.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ if($?) {
5353
# Publish zip to Azure
5454
Write-Host "> Publishing to Azure ..." -ForegroundColor Green
5555
Invoke-Expression "az webapp deployment source config-zip --resource-group $($resourceGroup) --name $($name) --src $($zipPath) --output json" -ErrorVariable publishError -OutVariable publishOutput 2>&1 | Out-Null
56-
Add-Content $logFile $publishOutput
57-
Add-Content $logFile $publishError
56+
Add-Content $logFile $publishOutput | Out-Null
57+
Add-Content $logFile $publishError | Out-Null
5858

5959
$err = $publishError | Where { $_.Exception.ErrorRecord -like "*ERROR*" }
6060

skills/src/csharp/calendarskill/calendarskill/Deployment/Scripts/publish.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ if($?) {
5353
# Publish zip to Azure
5454
Write-Host "> Publishing to Azure ..." -ForegroundColor Green
5555
Invoke-Expression "az webapp deployment source config-zip --resource-group $($resourceGroup) --name $($name) --src $($zipPath) --output json" -ErrorVariable publishError -OutVariable publishOutput 2>&1 | Out-Null
56-
Add-Content $logFile $publishOutput
57-
Add-Content $logFile $publishError
56+
Add-Content $logFile $publishOutput | Out-Null
57+
Add-Content $logFile $publishError | Out-Null
5858

5959
$err = $publishError | Where { $_.Exception.ErrorRecord -like "*ERROR*" }
6060

skills/src/csharp/emailskill/emailskill/Deployment/Scripts/publish.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ if($?) {
5353
# Publish zip to Azure
5454
Write-Host "> Publishing to Azure ..." -ForegroundColor Green
5555
Invoke-Expression "az webapp deployment source config-zip --resource-group $($resourceGroup) --name $($name) --src $($zipPath) --output json" -ErrorVariable publishError -OutVariable publishOutput 2>&1 | Out-Null
56-
Add-Content $logFile $publishOutput
57-
Add-Content $logFile $publishError
56+
Add-Content $logFile $publishOutput | Out-Null
57+
Add-Content $logFile $publishError | Out-Null
5858

5959
$err = $publishError | Where { $_.Exception.ErrorRecord -like "*ERROR*" }
6060

skills/src/csharp/experimental/bingsearchskill/bingsearchskill/Deployment/Scripts/publish.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ if($?) {
5353
# Publish zip to Azure
5454
Write-Host "> Publishing to Azure ..." -ForegroundColor Green
5555
Invoke-Expression "az webapp deployment source config-zip --resource-group $($resourceGroup) --name $($name) --src $($zipPath) --output json" -ErrorVariable publishError -OutVariable publishOutput 2>&1 | Out-Null
56-
Add-Content $logFile $publishOutput
57-
Add-Content $logFile $publishError
56+
Add-Content $logFile $publishOutput | Out-Null
57+
Add-Content $logFile $publishError | Out-Null
5858

5959
$err = $publishError | Where { $_.Exception.ErrorRecord -like "*ERROR*" }
6060

skills/src/csharp/experimental/eventskill/Deployment/Scripts/publish.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ if($?) {
5353
# Publish zip to Azure
5454
Write-Host "> Publishing to Azure ..." -ForegroundColor Green
5555
Invoke-Expression "az webapp deployment source config-zip --resource-group $($resourceGroup) --name $($name) --src $($zipPath) --output json" -ErrorVariable publishError -OutVariable publishOutput 2>&1 | Out-Null
56-
Add-Content $logFile $publishOutput
57-
Add-Content $logFile $publishError
56+
Add-Content $logFile $publishOutput | Out-Null
57+
Add-Content $logFile $publishError | Out-Null
5858

5959
$err = $publishError | Where { $_.Exception.ErrorRecord -like "*ERROR*" }
6060

skills/src/csharp/experimental/hospitalityskill/Deployment/Scripts/publish.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ if($?) {
5353
# Publish zip to Azure
5454
Write-Host "> Publishing to Azure ..." -ForegroundColor Green
5555
Invoke-Expression "az webapp deployment source config-zip --resource-group $($resourceGroup) --name $($name) --src $($zipPath) --output json" -ErrorVariable publishError -OutVariable publishOutput 2>&1 | Out-Null
56-
Add-Content $logFile $publishOutput
57-
Add-Content $logFile $publishError
56+
Add-Content $logFile $publishOutput | Out-Null
57+
Add-Content $logFile $publishError | Out-Null
5858

5959
$err = $publishError | Where { $_.Exception.ErrorRecord -like "*ERROR*" }
6060

skills/src/csharp/experimental/itsmskill/Deployment/Scripts/publish.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ if($?) {
5353
# Publish zip to Azure
5454
Write-Host "> Publishing to Azure ..." -ForegroundColor Green
5555
Invoke-Expression "az webapp deployment source config-zip --resource-group $($resourceGroup) --name $($name) --src $($zipPath) --output json" -ErrorVariable publishError -OutVariable publishOutput 2>&1 | Out-Null
56-
Add-Content $logFile $publishOutput
57-
Add-Content $logFile $publishError
56+
Add-Content $logFile $publishOutput | Out-Null
57+
Add-Content $logFile $publishError | Out-Null
5858

5959
$err = $publishError | Where { $_.Exception.ErrorRecord -like "*ERROR*" }
6060

skills/src/csharp/experimental/musicskill/Deployment/Scripts/publish.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ if($?) {
5353
# Publish zip to Azure
5454
Write-Host "> Publishing to Azure ..." -ForegroundColor Green
5555
Invoke-Expression "az webapp deployment source config-zip --resource-group $($resourceGroup) --name $($name) --src $($zipPath) --output json" -ErrorVariable publishError -OutVariable publishOutput 2>&1 | Out-Null
56-
Add-Content $logFile $publishOutput
57-
Add-Content $logFile $publishError
56+
Add-Content $logFile $publishOutput | Out-Null
57+
Add-Content $logFile $publishError | Out-Null
5858

5959
$err = $publishError | Where { $_.Exception.ErrorRecord -like "*ERROR*" }
6060

0 commit comments

Comments
 (0)