|
| 1 | +# Learning CI with GitHub Actions (Node.js App) |
| 2 | + |
| 3 | +Hi! 👋 |
| 4 | +This repository is a **Node.js backend project** that I randomly picked up (just for learning purposes) and tried implementing **CI (Continuous Integration)** using **GitHub Actions** for the first time. |
| 5 | + |
| 6 | +## 🧠 Why I Did This |
| 7 | + |
| 8 | +I wanted to learn how to: |
| 9 | +- Set up a basic GitHub Actions workflow |
| 10 | +- Automatically run steps like `npm install` after each push |
| 11 | +- Understand how CI works in real-time projects |
| 12 | + |
| 13 | +## 🔧 What I’ve Implemented |
| 14 | + |
| 15 | +✅ **CI (Continuous Integration)** is done! |
| 16 | +Every time I push code to the `main` branch: |
| 17 | +- GitHub Actions runs automatically |
| 18 | +- It installs dependencies using `npm install` |
| 19 | +- (Optional) It can run tests, but this project doesn't have any test cases yet. |
| 20 | + |
| 21 | +📂 Workflow file location: `.github/workflows/ci.yml` |
| 22 | + |
| 23 | +### GitHub Actions Workflow |
| 24 | + |
| 25 | +```yaml |
| 26 | + |
| 27 | +name: Node.js CI |
| 28 | + |
| 29 | +on: |
| 30 | + push: |
| 31 | + branches: [ "main" ] |
| 32 | + pull_request: |
| 33 | + branches: [ "main" ] |
| 34 | + |
| 35 | +jobs: |
| 36 | + build: |
| 37 | + runs-on: ubuntu-latest |
| 38 | + |
| 39 | + steps: |
| 40 | + - name: Checkout code |
| 41 | + uses: actions/checkout@v3 |
| 42 | + |
| 43 | + - name: Setup Node.js |
| 44 | + uses: actions/setup-node@v4 |
| 45 | + with: |
| 46 | + node-version: '18' |
| 47 | + |
| 48 | + - name: Install dependencies |
| 49 | + run: npm install |
| 50 | + |
| 51 | + - name: Placeholder test |
| 52 | + run: echo "No tests defined" |
| 53 | +``` |
| 54 | +
|
| 55 | +## ❓Did I Do CD (Continuous Deployment)? |
| 56 | +❌ Not yet. |
| 57 | +CD (automatically deploying code to a server or platform like EC2, Vercel, etc.) is not done here. |
| 58 | +
|
| 59 | +But I plan to: |
| 60 | +
|
| 61 | +Connect this to a server or platform in the next step |
| 62 | +
|
| 63 | +Deploy the app automatically once CI passes |
| 64 | +
|
| 65 | +## 🏁 How to Run Locally |
| 66 | +
|
| 67 | +``` |
| 68 | +git clone https://github.com/your-username/ci-cd-using-github-action.git |
| 69 | +cd ci-cd-using-github-action |
| 70 | +npm install |
| 71 | +node server.js |
| 72 | +``` |
| 73 | + |
| 74 | +## 🧑💻 Author |
| 75 | +Neha Bharti |
| 76 | +Just experimenting and learning DevOps! 💡 |
| 77 | + |
| 78 | + |
| 79 | +--- |
| 80 | + |
| 81 | +Let me know if you'd like me to help you **implement CD** as your next step — for example, deploying automatically to an EC2 server after CI passes. |
| 82 | + |
| 83 | + |
| 84 | + |
| 85 | + |
| 86 | + |
0 commit comments