Deploy to GitHub Pages
Host Gorilla for free directly from your GitHub repository
Why GitHub Pages?
- ✓ Always free - no paid tiers or upgrade pressure
- ✓ Integrated with GitHub - one platform for code and hosting
- ✓ GitHub Actions - powerful automation built-in
- ✓ Custom domains - easy HTTPS setup
- ⚠ Requires workflow setup - slightly more technical
Prerequisites
- GitHub account with your Gorilla repository
- YouTube API key (see YouTube API guide)
- Customized channels and settings in your repo
- Basic understanding of GitHub Actions (we'll guide you)
Step-by-Step Instructions
Add YouTube API Key to Secrets
In your GitHub repository, go to Settings → Secrets and variables → Actions.
Click "New repository secret" and add:
Name: YOUTUBE_API_KEY
Value: Your YouTube API key
Create GitHub Actions Workflow
Create a new file in your repository: .github/workflows/deploy.yml
Copy and paste this workflow configuration:
name: Deploy to GitHub Pages
on:
push:
branches: [main]
schedule:
- cron: '0 2 * * *' # Daily at 2 AM UTC
workflow_dispatch:
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Build site
env:
YOUTUBE_API_KEY: $
run: npm run build
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: $
publish_dir: ./_site
# cname: your-custom-domain.com # Optional: uncomment and set your domain
Enable GitHub Pages
Go to your repository Settings → Pages.
Under "Source", select:
Source: Deploy from a branch
Branch: gh-pages / / (root)
Click "Save".
Commit and Push Workflow
Commit the new workflow file and push to GitHub:
git add .github/workflows/deploy.yml
git commit -m "Add GitHub Pages deployment workflow"
git push origin main
Wait for Deployment
GitHub Actions will automatically run the workflow. Go to the "Actions" tab to watch the progress.
Once complete (2-5 minutes), your site will be live at https://your-username.github.io/gorilla/
Understanding the Workflow
The workflow file we created does three important things:
Automatic Deploys on Push
Every time you push to the main branch, the site rebuilds automatically.
Daily Automatic Rebuilds
The schedule trigger fetches new videos daily at 2 AM UTC. Adjust the cron schedule as needed.
Manual Trigger Option
The workflow_dispatch trigger lets you manually trigger a rebuild from the Actions tab.
Custom Domain (Optional)
To use your own domain with GitHub Pages:
- Go to repository Settings → Pages
- Under "Custom domain", enter your domain (e.g.,
kids.yourfamily.com) - Update your domain's DNS settings to point to GitHub Pages:
- Add a CNAME record pointing to
your-username.github.io
- Add a CNAME record pointing to
- Wait for DNS propagation (5-30 minutes)
- Enable "Enforce HTTPS" for secure connections
Updating Your Site
With the workflow in place, updates are automatic:
- Code changes: Push to GitHub, site rebuilds automatically
- New videos: Site rebuilds daily to fetch latest content
- Manual rebuild: Go to Actions tab → Select workflow → Click "Run workflow"
Troubleshooting
Workflow Failed
Check the Actions tab for error logs. Common issues: missing YOUTUBE_API_KEY secret or incorrect Node.js version.
404 on GitHub Pages
Ensure the gh-pages branch was created by the workflow. Check Settings → Pages to verify the correct branch is selected.
Videos Not Loading
Verify your YOUTUBE_API_KEY is correctly set in repository secrets (Settings → Secrets and variables → Actions).
Monitoring Builds
View all builds in the Actions tab:
- See build status (success, failure, in progress)
- View detailed logs for each step
- Re-run failed builds
- Check scheduled builds
Free Tier Limits
GitHub Pages and Actions are free for public repositories with:
- Storage: 1GB repository storage
- Bandwidth: 100GB/month
- Build time: 2,000 minutes/month (plenty for daily rebuilds)
✅ GitHub Pages Deployment Complete!
Your Gorilla instance is now hosted on GitHub Pages with automatic daily updates!