-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathdeployToAzureTEST.ps1
37 lines (27 loc) · 1.57 KB
/
deployToAzureTEST.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
$status = git status --porcelain
if ($status) { throw "There are uncommitted changes." }
az account set -s "<<your southwind subscription Id>>"
az acr login --name southwind
if(-Not $?){ Write-Host '"az acr login" failed' -ForegroundColor DarkRed; exit; }
Get-ChildItem -Path "Framework" -Recurse -Include "package.json","*.csproj" | Resolve-Path -Relative | tar -cf Framework.tar -T -
docker build -f ".\Southwind.React\Dockerfile" . -t southwind-test
if(-Not $?){ Write-Host '"docker build" failed' -ForegroundColor DarkRed; exit; }
docker tag southwind-test southwind.azurecr.io/signum/southwind-test
docker push southwind.azurecr.io/signum/southwind-test
if(-Not $?){ Write-Host '"docker push" failed' -ForegroundColor DarkRed; exit; }
$appName = 'southwind-app-test'
$resourceGroup = 'southwind-test'
$url = 'https://southwind-app-test.azurewebsites.net/'
Write-Host '# STOP slot' $slotName -ForegroundColor DarkRed
az webapp stop --resource-group $resourceGroup --name $appName
.\Framework\Utils\CheckUrl.exe dead $url
Write-Host
Write-Host '# SQL Migrations' -ForegroundColor Cyan
$env:ASPNETCORE_ENVIRONMENT='test'
$p = (Start-Process ".\Southwind.Terminal\bin\Debug\net8.0\Southwind.Terminal.exe" -ArgumentList "sql" -WorkingDirectory ".\Southwind.Terminal\bin\Debug\net8.0\" -NoNewWindow -Wait -PassThru)
if($p.ExitCode -eq -1){ Write-Host '"SQL Migrations" failed' -ForegroundColor DarkRed; exit; }
Write-Host
Write-Host '# START slot' $slotName -ForegroundColor DarkGreen
az webapp start --resource-group $resourceGroup --name $appName
.\Framework\Utils\CheckUrl.exe alive $url
Write-Host