|
| 1 | +# GitHub Pages Deployment Setup |
| 2 | + |
| 3 | +## What Was Added |
| 4 | + |
| 5 | +### 1. GitHub Actions Workflow (`.github/workflows/deploy.yml`) |
| 6 | + |
| 7 | +- Automatically builds and deploys to GitHub Pages on every push to `main` |
| 8 | +- Can also be triggered manually from the Actions tab |
| 9 | +- Uses pnpm for efficient dependency installation |
| 10 | +- Builds with `pnpm run build` |
| 11 | +- Deploys the `dist` folder to GitHub Pages |
| 12 | + |
| 13 | +### 2. Vite Configuration Update (`vite.config.ts`) |
| 14 | + |
| 15 | +- Added `base: "/observable-plot-scatter-poc/"` for correct asset paths on GitHub Pages |
| 16 | +- This ensures all JavaScript, CSS, and other assets load correctly from the subdirectory |
| 17 | + |
| 18 | +### 3. Jekyll Bypass (`public/.nojekyll`) |
| 19 | + |
| 20 | +- Empty file that tells GitHub Pages not to process the site with Jekyll |
| 21 | +- Ensures files starting with underscores (like Vite's `_assets/`) are served correctly |
| 22 | + |
| 23 | +## Manual Steps Required on GitHub |
| 24 | + |
| 25 | +### One-Time Setup (Required) |
| 26 | + |
| 27 | +1. **Go to Repository Settings** |
| 28 | + |
| 29 | + - Navigate to: https://github.com/InformaticsMatters/observable-plot-scatter-poc/settings/pages |
| 30 | + |
| 31 | +2. **Configure GitHub Pages** |
| 32 | + |
| 33 | + - Under "Build and deployment" |
| 34 | + - **Source**: Select "**GitHub Actions**" from the dropdown |
| 35 | + - (Don't select "Deploy from a branch" - we want to use the Actions workflow) |
| 36 | + |
| 37 | +3. **Wait for First Deployment** |
| 38 | + |
| 39 | + - Push these changes to the `main` branch |
| 40 | + - Go to the **Actions** tab to watch the deployment progress |
| 41 | + - First deployment takes 2-3 minutes |
| 42 | + |
| 43 | +4. **Access Your Site** |
| 44 | + - Once deployed, your app will be available at: |
| 45 | + - https://informaticsmatters.github.io/observable-plot-scatter-poc/ |
| 46 | + |
| 47 | +### That's It! |
| 48 | + |
| 49 | +After the initial setup, every push to `main` will automatically trigger a new deployment. No further manual steps needed. |
| 50 | + |
| 51 | +## Optional: Manual Deployment |
| 52 | + |
| 53 | +You can trigger a deployment manually without pushing code: |
| 54 | + |
| 55 | +1. Go to **Actions** tab: https://github.com/InformaticsMatters/observable-plot-scatter-poc/actions |
| 56 | +2. Click on "Deploy to GitHub Pages" workflow |
| 57 | +3. Click "Run workflow" button |
| 58 | +4. Select the `main` branch and click "Run workflow" |
| 59 | + |
| 60 | +## Troubleshooting |
| 61 | + |
| 62 | +### If deployment fails: |
| 63 | + |
| 64 | +- Check the Actions tab for error logs |
| 65 | +- Ensure the repository has Pages enabled in Settings |
| 66 | +- Verify that Actions have write permissions (Settings → Actions → General → Workflow permissions) |
| 67 | + |
| 68 | +### If site loads but shows 404: |
| 69 | + |
| 70 | +- Verify the `base` path in `vite.config.ts` matches your repository name |
| 71 | +- Check that all files are in the `dist` folder after build |
| 72 | + |
| 73 | +### To test locally before deploying: |
| 74 | + |
| 75 | +```sh |
| 76 | +pnpm run build |
| 77 | +pnpm run preview |
| 78 | +``` |
| 79 | + |
| 80 | +This simulates the production build with the correct base path. |
0 commit comments