-
Notifications
You must be signed in to change notification settings - Fork 8
57 lines (53 loc) · 2.11 KB
/
deploy-health-check.yml
File metadata and controls
57 lines (53 loc) · 2.11 KB
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# Post-deploy health check for Asper Beauty Shop (main project)
# Repo: asperpharma/understand-project
# Live: https://asperbeautyshop-com.lovable.app/
#
# Runs on every push to main. Waits for Lovable to deploy, then pings the
# frontend health URL. Optional: post result to Discord.
#
# SETUP: Copy this file into your understand-project repo at
# .github/workflows/deploy-health-check.yml
# Optional: Add Discord webhook in GitHub repo Settings → Secrets → Actions:
# DISCORD_WEBHOOK_URL = https://discord.com/api/webhooks/...
#
name: Deploy health check
on:
push:
branches: [main]
jobs:
health-check:
runs-on: ubuntu-latest
steps:
- name: Wait for Lovable deploy
run: |
echo "Lovable will deploy from this push. Waiting 120s for build to complete..."
sleep 120
- name: Check frontend health
run: |
SITE_URL="${SITE_URL:-https://asperbeautyshop-com.lovable.app}"
HEALTH_URL="${SITE_URL%/}/health"
echo "Checking $HEALTH_URL"
HTTP_CODE=$(curl -s -o /dev/null -w '%{http_code}' --connect-timeout 10 "$HEALTH_URL" || true)
if [ "$HTTP_CODE" = "200" ]; then
echo "Health check OK (200)"
echo "HEALTH_OK=true" >> $GITHUB_OUTPUT
else
echo "Health check returned HTTP $HTTP_CODE"
echo "HEALTH_OK=false" >> $GITHUB_OUTPUT
fi
id: health
env:
SITE_URL: https://asperbeautyshop-com.lovable.app
- name: Notify Discord (optional)
if: always() && secrets.DISCORD_WEBHOOK_URL != ''
env:
DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }}
run: |
if [ -n "$DISCORD_WEBHOOK_URL" ]; then
STATUS="${{ steps.health.outputs.HEALTH_OK == 'true' && 'OK' || 'Check dashboard' }}"
COMMIT="${{ github.sha }}"
SHORT="${COMMIT:0:7}"
curl -s -X POST "$DISCORD_WEBHOOK_URL" \
-H "Content-Type: application/json" \
-d "{\"content\": \"Deploy health: **$STATUS** | Commit \`$SHORT\` | https://asperbeautyshop-com.lovable.app\"}"
fi