Automate git pull and deploy from Cerewro

Set up a continuous update pipeline in Cerewro that runs git pull, installs dependencies, applies database migrations, restarts services and verifies the app is running. All from the chat or triggered by webhook.

Cerewro Chat — Full deploy
Update the app at C:\projects\my-web: run git pull, install npm dependencies, rebuild the project and restart the PM2 process "my-web"
Node.js deploy PowerShell script
Set-Location "C:\projects\my-web"
Write-Host "Pulling latest changes..."
git pull origin main
if ($LASTEXITCODE -ne 0) { throw "git pull failed" }

Write-Host "Installing dependencies..."
npm ci --production

Write-Host "Building..."
npm run build

Write-Host "Restarting service..."
pm2 restart my-web

Start-Sleep 3
$resp = Invoke-WebRequest -Uri "http://localhost:3000/health" -UseBasicParsing
if ($resp.StatusCode -eq 200) {
    Write-Host "Deploy OK" -ForegroundColor Green
} else {
    Write-Warning "Health check failed: $($resp.StatusCode)"
}
Quick rollback: If the deploy fails, tell Cerewro: "Roll back to the previous commit and restart the service". Cerewro runs git reset --hard HEAD~1, rebuilds and restarts automatically.