This repository demonstrates how to deploy a React application to GitHub Pages using Vite as the build tool. The project leverages a GitHub Actions workflow to statically compile the app and deploy it automatically to GitHub Pages.
- ⚡ Fast development and build with Vite
- ⚛️ React for building user interfaces
- 🚀 Automatic deployment to GitHub Pages via GitHub Actions
-
Install dependencies
npm install
-
Run the development server
npm run dev
-
Build for production
npm run build
-
Preview the build locally
npm run preview
This repository includes a GitHub Actions workflow that automatically builds and deploys your app to GitHub Pages on every push to the main
branch.
Important:
On first use, the initial workflow run will likely fail with an error. This is because GitHub Pages deployment is not enabled by default in repositories using this template.
To fix this:
- Go to your repository's Settings.
- Under the Pages section, set the source to "GitHub Actions" as appropriate.
- Enable "Allow GitHub Actions to deploy to GitHub Pages".
- Re-run the failed workflow from the Actions tab.
Once enabled, subsequent pushes to main
will trigger a build and deploy your site automatically.
After a successful deployment, your app will be available at:
https://<your-github-username>.github.io/<your-repo-name>/
Replace <your-github-username>
and <your-repo-name>
with your actual GitHub username and repository name.
This project is provided as an example and is open source under the MIT License.