Skip to content

This repository shows how to deploy a Vue 3 + Vite app to GitHub Pages using automated CI/CD with GitHub Actions. It includes scripts for local development and manual deployment, making it easy to get your project online. πŸ™πŸŒ

License

Notifications You must be signed in to change notification settings

Shivansh-aiml/vuejs-cicd-deploy-on-github-pages

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

27 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Vue.js CI/CD Deployment on GitHub Pages πŸš€

GitHub Pages

Welcome to the vuejs-cicd-deploy-on-github-pages repository! This project demonstrates how to set up a Vue 3 + Vite project using Bun or Node.js. It includes automated deployment to GitHub Pages using the gh-pages package and GitHub Actions.

Table of Contents

Introduction

In modern web development, Continuous Integration (CI) and Continuous Deployment (CD) are essential practices. They help automate the process of building, testing, and deploying applications. This repository focuses on integrating these practices into a Vue.js application, allowing developers to streamline their workflow.

Features

  • Set up a Vue 3 project with Vite.
  • Use Bun or Node.js as the runtime environment.
  • Automate deployment to GitHub Pages.
  • Utilize GitHub Actions for CI/CD.
  • Simple and clean project structure.

Getting Started

To get started with this project, follow the instructions below.

Prerequisites

Before you begin, ensure you have the following installed:

Installation

  1. Clone the repository:

    git clone https://github.com/Shivansh-aiml/vuejs-cicd-deploy-on-github-pages.git
  2. Navigate into the project directory:

    cd vuejs-cicd-deploy-on-github-pages
  3. Install the dependencies:

    If you are using Node.js:

    npm install

    If you are using Bun:

    bun install

Project Structure

The project structure is designed to be simple and intuitive. Here’s a breakdown:

vuejs-cicd-deploy-on-github-pages/
β”œβ”€β”€ public/                # Static assets
β”œβ”€β”€ src/                   # Source files
β”‚   β”œβ”€β”€ components/        # Vue components
β”‚   β”œβ”€β”€ App.vue            # Main application file
β”‚   └── main.js            # Entry point
β”œβ”€β”€ .github/               # GitHub Actions workflows
β”‚   └── workflows/
β”‚       └── deploy.yml     # Deployment workflow
β”œβ”€β”€ index.html             # HTML file
β”œβ”€β”€ package.json           # Project metadata and dependencies
└── vite.config.js         # Vite configuration

Configuration

To configure the project for deployment, update the vite.config.js file. Set the base property to your GitHub Pages URL:

export default defineConfig({
  base: '/vuejs-cicd-deploy-on-github-pages/',
  // other configurations...
});

Deployment

The deployment process is automated through GitHub Actions. Once you push changes to the main branch, the workflow defined in .github/workflows/deploy.yml will trigger and deploy your application to GitHub Pages.

To manually trigger a deployment, you can run:

npm run deploy

or

bun run deploy

GitHub Actions

The CI/CD pipeline is managed using GitHub Actions. The deployment workflow (deploy.yml) is set up to build the application and deploy it to GitHub Pages. Here’s a brief overview of the workflow:

name: Deploy to GitHub Pages

on:
  push:
    branches:
      - main

jobs:
  deploy:
    runs-on: ubuntu-latest

    steps:
      - name: Checkout code
        uses: actions/checkout@v2

      - name: Set up Node.js
        uses: actions/setup-node@v2
        with:
          node-version: '16'

      - name: Install dependencies
        run: npm install

      - name: Build
        run: npm run build

      - name: Deploy
        run: npx gh-pages -d dist

This workflow will:

  1. Check out the code.
  2. Set up the Node.js environment.
  3. Install dependencies.
  4. Build the project.
  5. Deploy the built files to GitHub Pages.

Contributing

We welcome contributions to this project. If you would like to contribute, please follow these steps:

  1. Fork the repository.
  2. Create a new branch for your feature or bug fix.
  3. Make your changes.
  4. Submit a pull request.

Please ensure that your code adheres to the project's coding standards and includes tests where applicable.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Releases

For the latest updates and releases, please visit the Releases section of this repository.

Feel free to download the latest version and execute it in your environment.


Thank you for checking out this repository! We hope you find it useful for your projects. If you have any questions or feedback, please feel free to reach out.

About

This repository shows how to deploy a Vue 3 + Vite app to GitHub Pages using automated CI/CD with GitHub Actions. It includes scripts for local development and manual deployment, making it easy to get your project online. πŸ™πŸŒ

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •