This document explains how to deploy your personal website to GitHub Pages.
- GitHub Repository: Your code should be in a GitHub repository
- GitHub Pages: Enable GitHub Pages in your repository settings
- Firebase Project (Optional): For message board functionality
- Go to your GitHub repository
- Click on Settings tab
- Scroll down to Pages section
- Under Source, select GitHub Actions
If you want the message board and danmaku system to work:
- Create a Firebase project at Firebase Console
- Enable Firestore Database
- Copy your Firebase configuration
- Create
src/firebase.jswith your config:
// Copy from src/firebase.example.js and replace with your values
const firebaseConfig = {
apiKey: "your-api-key",
authDomain: "your-project.firebaseapp.com",
projectId: "your-project-id",
storageBucket: "your-project.firebasestorage.app",
messagingSenderId: "your-sender-id",
appId: "your-app-id",
measurementId: "your-measurement-id"
};The website will automatically deploy when you:
- Push to the
mainbranch - The GitHub Action will build and deploy to
gh-pagesbranch
After deployment, your website will be available at:
https://yourusername.github.io/repository-name
For example: https://yuanky123.github.io/Yuanky123.github.io
- Firebase config is excluded from the repository for security
- API keys are protected by .gitignore
- The deployment uses a placeholder Firebase config that won't work
- To enable full functionality, you need to set up your own Firebase project
If you prefer manual deployment:
# Build the project
npm run build
# Deploy to GitHub Pages (if you have gh-pages package)
npm run deployTo use a custom domain:
- Add a
CNAMEfile to thepublic/directory - Put your domain name in the file
- Configure DNS settings with your domain provider
The build process:
- Uses Vite for bundling
- Outputs to
dist/directory - Includes all assets and optimized code
- Creates a placeholder Firebase config for deployment
- 404 Error: Make sure GitHub Pages is enabled and source is set to "GitHub Actions"
- Build Fails: Check that all dependencies are in package.json
- Firebase Not Working: You need to set up your own Firebase project
- Assets Not Loading: Check that paths are correct in your code
- Check the Actions tab in your GitHub repository
- Look at the build logs for any errors
- Verify that the
gh-pagesbranch was created - Check GitHub Pages settings
If you encounter issues:
- Check the GitHub Actions logs
- Verify your Firebase configuration
- Ensure all required files are committed
- Check that .gitignore is not excluding necessary files
Happy deploying! π