Files

28 lines
930 B
PowerShell

param (
[string]$FunctionName = "AlexaMalayalamCalendar"
)
$ProjectRoot = (Resolve-Path "$PSScriptRoot\..").Path
$DistPath = Join-Path -Path $ProjectRoot -ChildPath "dist"
$BuildScript = Join-Path -Path $PSScriptRoot -ChildPath "build.ps1"
$ZipPath = Join-Path -Path $DistPath -ChildPath "bundle.zip"
# 1. Run build script first to ensure dist/bundle.zip is fresh
Write-Host "Triggering build..." -ForegroundColor Cyan
powershell -ExecutionPolicy Bypass -File $BuildScript
if (-not (Test-Path -Path $ZipPath)) {
Write-Host "Build failed! $ZipPath not found." -ForegroundColor Red
exit 1
}
# 2. Upload to AWS Lambda
Write-Host "Deploying $ZipPath to AWS Lambda ($FunctionName)..." -ForegroundColor Cyan
aws lambda update-function-code `
--function-name $FunctionName `
--zip-file fileb://$ZipPath `
--no-cli-pager `
| Out-Null
Write-Host "Deployment finished successfully." -ForegroundColor Green