53 lines
2.0 KiB
PowerShell
53 lines
2.0 KiB
PowerShell
#!/usr/bin/env pwsh
|
|
# Simple Azure deployment script
|
|
|
|
Write-Host "🚀 Deploying Miracles in Motion to Azure..." -ForegroundColor Green
|
|
|
|
# Deploy infrastructure
|
|
Write-Host "Deploying infrastructure..." -ForegroundColor Yellow
|
|
$deployment = az deployment group create `
|
|
--resource-group rg-miraclesinmotion-prod `
|
|
--template-file infrastructure/main.bicep `
|
|
--parameters @infrastructure/main.parameters.json `
|
|
--name "infra-deploy-$(Get-Date -Format 'yyyyMMdd-HHmmss')" `
|
|
--output json | ConvertFrom-Json
|
|
|
|
if ($LASTEXITCODE -ne 0) {
|
|
Write-Error "❌ Infrastructure deployment failed!"
|
|
exit 1
|
|
}
|
|
|
|
Write-Host "✅ Infrastructure deployed successfully!" -ForegroundColor Green
|
|
|
|
# Get deployment outputs
|
|
$functionAppName = $deployment.properties.outputs.functionAppName.value
|
|
$staticWebAppName = $deployment.properties.outputs.staticWebAppName.value
|
|
|
|
Write-Host "Function App: $functionAppName" -ForegroundColor Cyan
|
|
Write-Host "Static Web App: $staticWebAppName" -ForegroundColor Cyan
|
|
|
|
# Install Azure Functions Core Tools if needed
|
|
Write-Host "Checking Azure Functions Core Tools..." -ForegroundColor Yellow
|
|
try {
|
|
func --version
|
|
} catch {
|
|
Write-Host "Installing Azure Functions Core Tools..." -ForegroundColor Yellow
|
|
npm install -g azure-functions-core-tools@4 --unsafe-perm true
|
|
}
|
|
|
|
# Deploy Functions
|
|
Write-Host "Deploying Azure Functions..." -ForegroundColor Yellow
|
|
Set-Location api
|
|
func azure functionapp publish $functionAppName --typescript
|
|
Set-Location ..
|
|
|
|
# Deploy Static Web App
|
|
Write-Host "Deploying Static Web App..." -ForegroundColor Yellow
|
|
az staticwebapp deploy `
|
|
--name $staticWebAppName `
|
|
--resource-group rg-miraclesinmotion-prod `
|
|
--source dist/
|
|
|
|
Write-Host "🎉 Deployment completed successfully!" -ForegroundColor Green
|
|
Write-Host "🌐 Frontend URL: https://$staticWebAppName.azurestaticapps.net" -ForegroundColor Cyan
|
|
Write-Host "⚡ Functions URL: https://$functionAppName.azurewebsites.net" -ForegroundColor Cyan |