Thanks to visit codestin.com
Credit goes to github.com

Skip to content

264Gaurav/gitHubAction-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GitHub Action - CI/CD Pipeline

This repository contains a GitHub Action workflow designed to automate the CI/CD pipeline for your project. The workflow ensures that your code is built, tested, and deployed efficiently.

Features

  • Continuous Integration (CI):

    • Automatically builds and tests your code on every push or pull request.
    • Ensures code quality and prevents breaking changes.
  • Continuous Deployment (CD):

    • Deploys your application to the specified environment (e.g., staging, production) after successful tests.
    • Supports multiple deployment strategies (e.g., rolling updates, blue-green deployments).

Workflow Overview

The GitHub Action workflow is defined in the .github/workflows/ci-cd.yml file. Below is an overview of the key steps:

  1. Trigger Events:
  • Runs on push to the main branch.
  • Runs on pull_request events.
  1. Build:
  • Installs dependencies.
  • Builds the application.
  1. Test:
  • Runs unit tests and integration tests.
  • Generates test reports.
  1. Deploy:
  • Deploys the application to the target environment.

Usage

  1. Clone this repository:
git clone <repository-url>
  1. Navigate to the repository:
cd <repository-name>
  1. Update the .github/workflows/ci-cd.yml file to match your project requirements (e.g., build commands, test scripts, deployment steps).

  2. Stage and commit your changes, then push to GitHub:

git add .
git commit -m "Set up CI/CD pipeline"
git push origin main

Example Workflow File

Below is an example of a GitHub Actions workflow file:

name: CI/CD Pipeline

on: push: branches: - main pull_request:

jobs: build: runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v3

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

  - name: Install dependencies
    run: npm install

  - name: Run tests
    run: npm test

deploy: runs-on: ubuntu-latest needs: build steps: - name: Deploy to production run: echo "Deploying application..."

Releases

No releases published

Packages

No packages published

Languages