Easiest Way to Deploy a Vite App to GitHub Pages with GitHub Actions (2025)
If you’ve just built a shiny new Vite project and want to show it off to the world, GitHub Pages is one of the fastest and free ways to host it.
With GitHub Actions, you can automate the entire deployment process — no more manually running build commands or dragging files around.
This guide walks you step-by-step through the easiest way to deploy a Vite app to GitHub Pages in 2025.
Step 1 — Create Your Vite App
If you haven’t created your app yet, open your terminal and run:
Step 2 — Update vite.config.js for GitHub Pages
When deploying to GitHub Pages, you must set the base property in your Vite config to your repo name.
GitHub Pages serves your site from https://username.github.io/<repo-name>/ (not the root /), so Vite needs to know the correct base path for assets.
Step 3 — Create the GitHub Action Workflow
GitHub Actions will:
- Build your Vite app.
- Upload it to GitHub Pages automatically.
In your project root (same place as package.json), create: .github/workflows/deploy.yml
Now paste this code into deploy.yml:
Step 4 — Enable GitHub Pages
- Go to Repo → Settings → Pages.
- Under Source, select Deploy from GitHub Actions.
Now, every time you push changes to your main branch, GitHub Actions will:
- Build your Vite app.
- Deploy it automatically to GitHub Pages.
- Give you a live URL right in the Actions log.
Example Repo: Vite + GitHub Pages Deployment via Actions