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:
- Scaffold a new Vite app and initialize git.
- Create a new GitHub repository on github.com.
- Create a deployment workflow file
.github/workflows/deploy.yml
and add the provided code snippet. - Customize Actions Settings to grant write permissions for the deployment workflow.
- Enable GitHub Pages and set the source to
gh-pages
. - Adjust asset links in the
vite.config.js
file to match the GitHub Pages URL structure. - 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.