Skip to content

Commit

Permalink
Update and rename main.yml to build-and-deploy.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
CharanMN7 authored Oct 29, 2023
1 parent 6601a47 commit 13bfc3c
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 34 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/build-and-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Build and Deploy React Website

on:
push:
branches:
- main

jobs:
build-and-deploy:
runs-on: ubuntu-latest

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

- name: Install dependencies
run: npm install

- name: Build React app
run: npm run build

- name: Deploy to GitHub Pages
uses: actions/github-script@v5
with:
script: |
# Create the gh-pages branch if it doesn't exist
git checkout -b gh-pages || git checkout gh-pages
# Copy the build files to the gh-pages branch
cp -r build/* .
# Commit and push the changes
git add .
git commit -m "Deploy React website"
git push origin gh-pages
# Return to the main branch
git checkout main
34 changes: 0 additions & 34 deletions .github/workflows/main.yml

This file was deleted.

0 comments on commit 13bfc3c

Please sign in to comment.