Vite Deploy Demo screenshot

Vite Deploy Demo

Author Avatar Theme by Sitek94
Updated: 22 Apr 2025
363 Stars

Deploy Vite app to GitHub Pages using GitHub Actions

Categories

Overview:

Deploying a Vite app to GitHub Pages using GitHub Actions can streamline the process of hosting your web application. This tutorial provides a step-by-step guide on scaffolding a new Vite app, creating a GitHub repository, setting up deployment workflows, enabling GitHub Pages, and fixing asset links for successful deployment.

Features:

  • Scaffold a New Vite App and Init Git: Quickly set up a new Vite app and initialize a git repository for version control.
  • Create Deployment Workflow: Automate the deployment process by creating a deployment workflow file.
  • Enable GitHub Pages: Easily host your web application on GitHub Pages with simple configuration settings.
  • Fix Assets Links: Resolve issues with asset links by adjusting paths in the vite.config.js file.

Installation:

  1. Scaffold a new Vite app and initialize git.
  2. Create a new GitHub repository on github.com.
  3. Create a deployment workflow file .github/workflows/deploy.yml and add the provided code snippet.
  4. Customize Actions Settings to grant write permissions for the deployment workflow.
  5. Enable GitHub Pages and set the source to gh-pages.
  6. Adjust asset links in the vite.config.js file to match the GitHub Pages URL structure.
  7. Commit changes, push the code, and wait for deployment to finish successfully.

Summary:

The process of deploying a Vite app to GitHub Pages using GitHub Actions involves setting up the app, creating a repository, configuring deployment workflows, enabling GitHub Pages, and fixing asset links. By following the step-by-step instructions provided in the tutorial, users can effectively deploy their Vite apps and make them accessible online.