|
| 1 | +# GitHub Pages Deployment Guide |
| 2 | + |
| 3 | +This project is configured for deployment to GitHub Pages using the `gh-pages` package. |
| 4 | + |
| 5 | +## Setup Instructions |
| 6 | + |
| 7 | +1. **Update the homepage URL**: |
| 8 | + - Open `package.json` |
| 9 | + - Replace `your-username` and `your-repo-name` in the homepage field with your actual GitHub username and repository name: |
| 10 | + ```json |
| 11 | + "homepage": "https://your-username.github.io/your-repo-name" |
| 12 | + ``` |
| 13 | + |
| 14 | +2. **Enable GitHub Pages** (if not already done): |
| 15 | + - Go to your GitHub repository |
| 16 | + - Navigate to Settings → Pages |
| 17 | + - Set Source to "Deploy from a branch" |
| 18 | + - Select the `gh-pages` branch (this will be created automatically when you first deploy) |
| 19 | + |
| 20 | +## Deployment Commands |
| 21 | + |
| 22 | +The following scripts are available for deployment: |
| 23 | + |
| 24 | +```bash |
| 25 | +# Build the client-side application only |
| 26 | +npm run build:client |
| 27 | + |
| 28 | +# Build and deploy to GitHub Pages (runs predeploy automatically) |
| 29 | +npm run deploy |
| 30 | + |
| 31 | +# Predeploy script (builds the project before deployment) |
| 32 | +npm run predeploy |
| 33 | +``` |
| 34 | + |
| 35 | +## Deployment Process |
| 36 | + |
| 37 | +1. **Make your changes** and commit them to your main branch |
| 38 | +2. **Deploy to GitHub Pages**: |
| 39 | + ```bash |
| 40 | + npm run deploy |
| 41 | + ``` |
| 42 | + |
| 43 | +This will: |
| 44 | +- Run the `predeploy` script which builds the client application |
| 45 | +- Deploy the `build` directory contents to the `gh-pages` branch |
| 46 | +- Your site will be available at the URL specified in the homepage field |
| 47 | + |
| 48 | +## Important Notes |
| 49 | + |
| 50 | +- Only the client-side React application is deployed to GitHub Pages |
| 51 | +- The server components are not deployed (GitHub Pages only serves static files) |
| 52 | +- The `build` directory is excluded from version control via `.gitignore` |
| 53 | +- Make sure to update the homepage URL in `package.json` before deploying |
| 54 | + |
| 55 | +## Troubleshooting |
| 56 | + |
| 57 | +If deployment fails: |
| 58 | +1. Ensure you have the correct repository permissions |
| 59 | +2. Verify the homepage URL is correct |
| 60 | +3. Check that GitHub Pages is enabled in repository settings |
| 61 | +4. Make sure the `gh-pages` branch exists and is set as the Pages source |
0 commit comments