|
| 1 | +# GitHub Pages Auto-Deployment Setup |
| 2 | + |
| 3 | +## ✅ Current Configuration |
| 4 | + |
| 5 | +### GitHub Actions Workflow |
| 6 | +- **File**: `.github/workflows/deploy.yml` |
| 7 | +- **Trigger**: Automatic on every push to `main` branch |
| 8 | +- **Manual trigger**: Available via workflow_dispatch |
| 9 | + |
| 10 | +### What Happens Automatically |
| 11 | + |
| 12 | +1. **On Push to Main**: |
| 13 | + - GitHub Actions workflow starts |
| 14 | + - Installs Node.js dependencies |
| 15 | + - Runs `npm run build` |
| 16 | + - Creates production bundle in `dist/` |
| 17 | + - Uploads to GitHub Pages |
| 18 | + - Deploys to live site |
| 19 | + |
| 20 | +2. **Live URL**: https://top-5.github.io/klondike/ |
| 21 | + |
| 22 | +3. **Status Badge**: Shows deployment status in README |
| 23 | + |
| 24 | +## 🛠️ Required GitHub Settings |
| 25 | + |
| 26 | +To ensure this works, verify these settings in your GitHub repository: |
| 27 | + |
| 28 | +1. Go to: **Settings** → **Pages** |
| 29 | +2. Under **Build and deployment**: |
| 30 | + - **Source**: Should be set to **GitHub Actions** (not "Deploy from a branch") |
| 31 | +3. Under **Settings** → **Environments**: |
| 32 | + - Should see `github-pages` environment |
| 33 | + |
| 34 | +## 🔄 Deployment Methods |
| 35 | + |
| 36 | +### Method 1: Automatic (Recommended) |
| 37 | +```bash |
| 38 | +git add . |
| 39 | +git commit -m "Your changes" |
| 40 | +git push |
| 41 | +# GitHub Actions automatically builds and deploys! |
| 42 | +``` |
| 43 | + |
| 44 | +### Method 2: Manual via npm script |
| 45 | +```bash |
| 46 | +npm run deploy |
| 47 | +# Uses gh-pages package to deploy directly |
| 48 | +``` |
| 49 | + |
| 50 | +### Method 3: Manual workflow trigger |
| 51 | +- Go to GitHub → Actions → Deploy to GitHub Pages |
| 52 | +- Click "Run workflow" |
| 53 | + |
| 54 | +## 📊 Monitoring |
| 55 | + |
| 56 | +- **Workflow runs**: https://github.com/top-5/klondike/actions |
| 57 | +- **Deployment status**: Check the badge in README.md |
| 58 | +- **Live site**: https://top-5.github.io/klondike/ |
| 59 | + |
| 60 | +## 🎯 Benefits of Auto-Deploy |
| 61 | + |
| 62 | +✅ No manual deployment needed |
| 63 | +✅ Always deploys latest from main branch |
| 64 | +✅ Build errors caught in CI/CD |
| 65 | +✅ Deployment history tracked in Actions |
| 66 | +✅ Consistent build environment |
| 67 | +✅ Status visible via badge |
| 68 | + |
| 69 | +## 🔧 Troubleshooting |
| 70 | + |
| 71 | +If deployment fails: |
| 72 | +1. Check the Actions tab for error logs |
| 73 | +2. Verify GitHub Pages is set to use "GitHub Actions" |
| 74 | +3. Check workflow permissions (needs `pages: write`) |
| 75 | +4. Ensure repository has Pages enabled |
0 commit comments