Configure Colors
GitHub Pages Deployment Guide
This project is configured to automatically deploy to GitHub Pages whenever changes are merged to the master
branch.
Setup Instructions
1. Enable GitHub Pages
- Go to your repository on GitHub
- Navigate to Settings → Pages
- Under "Source", select GitHub Actions
- Save the configuration
2. Repository Permissions
The workflow requires the following permissions to deploy to GitHub Pages:
contents: read
- To read the repository contentpages: write
- To deploy to GitHub Pagesid-token: write
- For secure deployment authentication
These permissions are automatically configured in the workflow file.
3. Deployment Process
The deployment happens automatically when:
- Code is pushed to the
master
branch - A pull request is merged to
master
- The workflow is manually triggered from the Actions tab
Manual Deployment
You can also trigger a deployment manually:
- Go to Actions tab in your GitHub repository
- Select "Deploy VitePress Site" workflow
- Click "Run workflow" button
- Choose the branch (typically
master
) and click "Run workflow"
How It Works
The deployment workflow consists of two jobs:
Build Job
- Checkout: Downloads the repository code
- Setup Node.js: Installs Node.js v20
- Setup pnpm: Installs pnpm package manager with the exact version specified in
package.json
- Cache: Caches pnpm dependencies for faster builds
- Install: Installs all project dependencies
- Generate: Runs
pnpm run build
to generate the VitePress content using your scripts - Build: Runs
pnpm run docs:build
to build the static VitePress site - Upload: Uploads the built site as an artifact for deployment
Deploy Job
- Deploy: Deploys the built site to GitHub Pages
Build Scripts
The deployment uses these npm scripts in sequence:
json
{
"build": "tsx scripts/generate-site.ts", // Generates content from your data
"docs:build": "vitepress build docs" // Builds the VitePress static site
}
Output Location
- Source:
docs/
directory contains your VitePress markdown files - Build Output:
docs/.vitepress/dist/
contains the built static site - Deployment: The contents of the dist folder are deployed to GitHub Pages
Troubleshooting
Build Failures
If the deployment fails:
- Check the Actions tab for detailed error logs
- Common issues:
- Node.js version compatibility
- Missing dependencies
- Build script errors
- TypeScript compilation errors
Access Your Site
Once deployed successfully, your site will be available at:
https://<username>.github.io/<repository-name>/
- Or your custom domain if configured
Local Testing
Before pushing, you can test the build locally:
bash
# Generate content
pnpm run build
# Build VitePress site
pnpm run docs:build
# Preview the built site
pnpm run docs:preview
Workflow Configuration
The workflow file is located at .github/workflows/deploy.yml
and includes:
- Trigger: Runs on pushes to
master
branch - Node Version: 20 (as specified in package.json engines)
- Package Manager: pnpm with exact version from packageManager field
- Caching: Intelligent dependency caching for faster builds
- Security: Uses official GitHub Actions with proper permissions
Performance Features
- Dependency Caching: pnpm dependencies are cached between runs
- Concurrent Jobs: Build and deploy run in sequence but are optimized
- Artifact Upload: Efficient transfer of build output to deployment
- Incremental Builds: VitePress only rebuilds changed content