Course contentsShow
← Web Development
Lesson 1810 of 2,98233. Static Site Generation and JamstackFree lesson

GitHub Pages

Deploying static sites with GitHub Pages and GitHub Actions for custom build workflows.

GitHub Pages

You'll learn how to deploy static sites for free using GitHub Pages and automate builds with GitHub Actions.

What is GitHub Pages?

GitHub Pages is a free static site hosting service that publishes HTML, CSS, and JavaScript directly from a GitHub repository. It's perfect for documentation sites, portfolios, project demos, and blogs. Think of it as a simple web server that automatically updates whenever you push changes to your repository—no complex infrastructure needed.

How It Works

GitHub Pages serves files from a specific branch (usually main or gh-pages) or from a /docs folder. For simple sites with pre-built files, you just push your HTML/CSS/JS and enable Pages in your repository settings. Your site appears at username.github.io/repository-name.

Custom Builds with GitHub Actions

While GitHub Pages natively supports Jekyll (a static site generator), you can build any static site using GitHub Actions for custom workflows. This is crucial for modern SSG frameworks like those you've learned about.

Here's the pattern:

  1. Trigger: A push to your repository starts a GitHub Action workflow
  2. Build: The workflow installs dependencies and runs your build command (like npm run build)
  3. Deploy: The workflow pushes the generated static files to the Pages serving location

This approach works with Netlify-style build commands, Vercel-compatible projects, or any SSG that outputs static HTML. The Action handles what those platforms do automatically—run your build process in the cloud and serve the results.

Why Use GitHub Pages?

  • Free hosting with HTTPS
  • Automatic deployments on every push
  • Custom domains supported
  • Full control over build process via Actions

Key Takeaway: GitHub Pages provides free static hosting that, when combined with GitHub Actions, supports any SSG build workflow—giving you deployment automation similar to dedicated platforms like Netlify or Vercel, but with complete build customization.