|
| 1 | +# GitHub Actions Workflows |
| 2 | + |
| 3 | +This directory contains automated workflows for the Support Tools website. |
| 4 | + |
| 5 | +## Workflows |
| 6 | + |
| 7 | +### 1. cloudflare-workers.yml - Cloudflare Workers Deployment |
| 8 | + |
| 9 | +**Purpose**: Deploy the Hugo static site to Cloudflare Workers |
| 10 | + |
| 11 | +**Triggers**: |
| 12 | +- **Push to main**: Deploys to staging, then production |
| 13 | +- **Pull Request**: Deploys to development for preview |
| 14 | +- **Manual dispatch**: Deploy to any specific environment |
| 15 | +- **Schedule**: Daily at midnight UTC (content refresh) |
| 16 | + |
| 17 | +**Deployment Flow**: |
| 18 | + |
| 19 | +```mermaid |
| 20 | +graph TD |
| 21 | + A[Trigger] --> B[Test/Build Hugo] |
| 22 | + B --> C{Branch?} |
| 23 | + C -->|PR| D[Deploy to Dev] |
| 24 | + C -->|main| E[Deploy to Staging] |
| 25 | + E --> F[Deploy to Production] |
| 26 | + C -->|manual| G[Deploy to Selected Env] |
| 27 | +``` |
| 28 | + |
| 29 | +**Environments**: |
| 30 | +- `development` - https://dev.support.tools |
| 31 | +- `mst` - https://mst.support.tools |
| 32 | +- `qas` - https://qas.support.tools |
| 33 | +- `tst` - https://tst.support.tools |
| 34 | +- `staging` - https://stg.support.tools |
| 35 | +- `production` - https://support.tools |
| 36 | + |
| 37 | +**Environment Protection**: |
| 38 | +- Production requires manual approval |
| 39 | +- Staging auto-deploys from main branch |
| 40 | +- Development auto-deploys for PRs |
| 41 | + |
| 42 | +### 2. pipeline.yml - Legacy Kubernetes Deployment (Deprecated) |
| 43 | + |
| 44 | +**Status**: DEPRECATED - Use cloudflare-workers.yml instead |
| 45 | + |
| 46 | +**Purpose**: Previously deployed to Kubernetes clusters via ArgoCD |
| 47 | + |
| 48 | +## Required Secrets |
| 49 | + |
| 50 | +Configure these in Settings → Secrets → Actions: |
| 51 | + |
| 52 | +- `CLOUDFLARE_API_TOKEN` - API token with Workers:Edit permissions |
| 53 | + |
| 54 | +## Usage Examples |
| 55 | + |
| 56 | +### Manual Deployment |
| 57 | + |
| 58 | +1. Go to Actions tab |
| 59 | +2. Select "Deploy to Cloudflare Workers" |
| 60 | +3. Click "Run workflow" |
| 61 | +4. Select environment |
| 62 | +5. Click "Run workflow" |
| 63 | + |
| 64 | +### Automatic Deployments |
| 65 | + |
| 66 | +- **Production**: Push to `main` branch |
| 67 | +- **Development**: Create a pull request |
| 68 | +- **Daily refresh**: Automatic at midnight UTC |
| 69 | + |
| 70 | +## Monitoring Deployments |
| 71 | + |
| 72 | +### View Logs |
| 73 | +```bash |
| 74 | +# Real-time logs |
| 75 | +wrangler tail --env production |
| 76 | + |
| 77 | +# GitHub Actions logs |
| 78 | +gh run list --workflow=cloudflare-workers.yml |
| 79 | +gh run view <run-id> |
| 80 | +``` |
| 81 | + |
| 82 | +### Check Status |
| 83 | +```bash |
| 84 | +# Check all environments |
| 85 | +for env in dev mst qas tst stg ""; do |
| 86 | + url="https://${env}${env:+.}support.tools" |
| 87 | + echo -n "$url: " |
| 88 | + curl -s -o /dev/null -w "%{http_code}\n" $url |
| 89 | +done |
| 90 | +``` |
| 91 | + |
| 92 | +## Rollback Procedure |
| 93 | + |
| 94 | +1. **Via GitHub**: |
| 95 | + ```bash |
| 96 | + # List recent deployments |
| 97 | + gh run list --workflow=cloudflare-workers.yml --limit 10 |
| 98 | + |
| 99 | + # Re-run a previous successful deployment |
| 100 | + gh run rerun <run-id> |
| 101 | + ``` |
| 102 | + |
| 103 | +2. **Via Wrangler**: |
| 104 | + ```bash |
| 105 | + # List versions |
| 106 | + wrangler deployments list |
| 107 | + |
| 108 | + # Rollback to previous version |
| 109 | + wrangler rollback --env production |
| 110 | + ``` |
| 111 | + |
| 112 | +## Troubleshooting |
| 113 | + |
| 114 | +### Deployment Fails |
| 115 | + |
| 116 | +1. Check GitHub Actions logs |
| 117 | +2. Verify CLOUDFLARE_API_TOKEN is set |
| 118 | +3. Check Hugo build output |
| 119 | +4. Verify DNS is pointing to Cloudflare |
| 120 | + |
| 121 | +### Site Not Updating |
| 122 | + |
| 123 | +1. Clear Cloudflare cache |
| 124 | +2. Check if deployment completed |
| 125 | +3. Verify correct environment deployed |
| 126 | +4. Check Workers logs: `wrangler tail` |
| 127 | + |
| 128 | +### Performance Issues |
| 129 | + |
| 130 | +1. Check Workers analytics in Cloudflare Dashboard |
| 131 | +2. Monitor request duration in logs |
| 132 | +3. Verify static assets are cached |
| 133 | +4. Check for large unoptimized images |
| 134 | + |
| 135 | +## Migration from Kubernetes |
| 136 | + |
| 137 | +The site has been migrated from Kubernetes to Cloudflare Workers: |
| 138 | + |
| 139 | +- **Old**: Docker → Kubernetes → ArgoCD → Nginx |
| 140 | +- **New**: Hugo → Cloudflare Workers → Global CDN |
| 141 | + |
| 142 | +Benefits: |
| 143 | +- ✅ Free hosting for static assets |
| 144 | +- ✅ Global edge deployment |
| 145 | +- ✅ No infrastructure to manage |
| 146 | +- ✅ Faster deployment times |
| 147 | +- ✅ Better performance |
0 commit comments