|
| 1 | +#!/bin/bash |
| 2 | +set -e |
| 3 | + |
| 4 | +MSG="${1:-fix og-image}" |
| 5 | + |
| 6 | +# Stage and commit |
| 7 | +git add -A |
| 8 | +git commit -m "$MSG" || { echo "Nothing to commit"; exit 0; } |
| 9 | +git push |
| 10 | + |
| 11 | +# Wait for workflow to start |
| 12 | +echo "Waiting for workflow to start..." |
| 13 | +sleep 5 |
| 14 | + |
| 15 | +# Get the latest run ID |
| 16 | +RUN_ID=$(gh run list --limit 1 --json databaseId --jq '.[0].databaseId') |
| 17 | +echo "Watching run $RUN_ID..." |
| 18 | + |
| 19 | +# Wait for it to finish |
| 20 | +gh run watch "$RUN_ID" --exit-status || { echo "Build failed!"; gh run view "$RUN_ID" --log-failed; exit 1; } |
| 21 | + |
| 22 | +echo "" |
| 23 | +echo "=== Deploy complete. Checking OG image ===" |
| 24 | +echo "" |
| 25 | + |
| 26 | +# Check what meta tag says |
| 27 | +echo "--- Meta tags ---" |
| 28 | +curl -sL https://rbby.dev/gnata-sqlite/ | grep -i 'og:image' | head -5 || echo "(no og:image found)" |
| 29 | + |
| 30 | +echo "" |
| 31 | + |
| 32 | +# Extract OG image URL (macOS-compatible) |
| 33 | +OG_URL=$(python3 -c " |
| 34 | +import re, urllib.request |
| 35 | +html = urllib.request.urlopen('https://rbby.dev/gnata-sqlite/').read().decode() |
| 36 | +m = re.search(r'og:image\" content=\"([^\"]+)\"', html) |
| 37 | +print(m.group(1) if m else '') |
| 38 | +") |
| 39 | + |
| 40 | +if [ -n "$OG_URL" ]; then |
| 41 | + echo "OG image URL: $OG_URL" |
| 42 | + STATUS=$(curl -sL -o /dev/null -w "%{http_code}" "$OG_URL") |
| 43 | + CONTENT_TYPE=$(curl -sL -o /dev/null -w "%{content_type}" "$OG_URL") |
| 44 | + echo "HTTP status: $STATUS" |
| 45 | + echo "Content-Type: $CONTENT_TYPE" |
| 46 | + if [ "$STATUS" = "200" ] && echo "$CONTENT_TYPE" | grep -q "image"; then |
| 47 | + echo "OG image is working!" |
| 48 | + else |
| 49 | + echo "OG image is NOT working" |
| 50 | + fi |
| 51 | +else |
| 52 | + echo "Could not extract og:image URL" |
| 53 | +fi |
0 commit comments