Update README.md #84
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI/CD Pipeline | |
on: | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
# 1. Checkout the code from your repository | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
# 2. Set up Node.js environment | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 'v20.18.0' | |
# 3. Install dependencies for both frontend (React with Vite) and backend (Node.js) | |
- name: Install dependencies | |
run: | | |
cd frontend | |
npm install | |
cd ../backend | |
npm install | |
# 4. Start Node.js Server (Backend) | |
- name: Start Node.js Server (Backend) | |
run: | | |
cd backend | |
nohup npm run start:prod & | |
# 6. Start React App (Frontend) | |
- name: Start React App (Frontend) | |
run: | | |
cd frontend | |
nohup npm run dev & | |
# 7. Wait for apps to start (longer wait time to ensure both are running) | |
- name: Wait for apps to start | |
run: | | |
sleep 10 | |
# 8. Check if React app is running on localhost | |
- name: Check if React app is running | |
run: | | |
curl --fail http://localhost:5173 || exit 1 | |
# deploy: | |
# needs: build # Ensures deploy only runs if the build job is successful | |
# runs-on: ubuntu-latest | |
# steps: | |
# - name: Checkout code | |
# uses: actions/checkout@v3 | |
# - name: Authenticate | |
# run: | | |
# # Deploy Fronten | |
# - name: Deploy Frontend | |
# run: | | |
# # Deploy Backend | |
# - name: Deploy Backend | |
# run: | | |
# cd backend |