Files
simcoetradesjournal/.github/workflows/deploy.yml
T
Your Name b21427d182 Fix DO app name: simcoetradesjournal -> simcoetradesjournal2
The actual DO app is named simcoetradesjournal2 (not simcoetradesjournal).
Also updated .do/app.yaml to match.
2026-08-01 06:18:42 -04:00

92 lines
2.8 KiB
YAML

name: Build & Deploy Jekyll Site
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.3'
bundler-cache: true
- name: Build site with Jekyll
run: |
JEKYLL_ENV=production bundle exec jekyll build
env:
JEKYLL_ENV: production
- name: Deploy to DigitalOcean App Platform
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
run: |
set -euo pipefail
TOKEN="$DIGITALOCEAN_TOKEN"
# List all apps with full details
echo "=== Fetching apps from DO API ==="
APPS_JSON=$(curl -s -w "\n%{http_code}" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
"https://api.digitalocean.com/v2/apps?page=1&page_limit=20")
HTTP_CODE=$(echo "$APPS_JSON" | tail -1)
BODY=$(echo "$APPS_JSON" | sed '$d')
echo "HTTP Status: $HTTP_CODE"
if [ "$HTTP_CODE" != "200" ]; then
echo "ERROR: DO API returned $HTTP_CODE"
echo "Response: $BODY"
exit 1
fi
# Show all app names for debugging
echo "=== All apps found ==="
echo "$BODY" | jq -r '.apps[] | " - \(.spec.name) (id: \(.id))"'
# Find app ID — try exact name match first, then partial
APP_ID=$(echo "$BODY" | jq -r '.apps[] | select(.spec.name == "simcoetradesjournal2") | .id' | head -1)
if [ -z "$APP_ID" ] || [ "$APP_ID" = "null" ]; then
echo "ERROR: Could not find DO app named 'simcoetradesjournal2'"
echo "Full response:"
echo "$BODY" | jq .
exit 1
fi
echo "=== Found DO app ID: $APP_ID ==="
# Trigger deployment
echo "=== Triggering deployment ==="
DEPLOY_JSON=$(curl -s -w "\n%{http_code}" -X POST \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
"https://api.digitalocean.com/v2/apps/$APP_ID/deploy")
DEPLOY_HTTP=$(echo "$DEPLOY_JSON" | tail -1)
DEPLOY_BODY=$(echo "$DEPLOY_JSON" | sed '$d')
echo "Deploy HTTP Status: $DEPLOY_HTTP"
if [ "$DEPLOY_HTTP" != "200" ]; then
echo "ERROR: Deploy API returned $DEPLOY_HTTP"
echo "Response: $DEPLOY_BODY"
exit 1
fi
DEPLOY_ID=$(echo "$DEPLOY_BODY" | jq -r '.deployments[0].id // empty')
echo "=== Deployment triggered successfully ==="
echo "Deploy ID: $DEPLOY_ID"
env:
DIGITALOCEAN_TOKEN: ${{ secrets.DIGITALOCEAN_TOKEN }}