Skip to content

Commit c2e2dff

Browse files
authored
added github actions " brain file'' (workflow file)
This sets up automatic CI/CD pipeline: - Installs Node.js dependencies - Runs tests and builds the app - Builds Docker image and pushes to DockerHub Triggered on every push to main branch.
1 parent b9b2dd5 commit c2e2dff

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

.github/workflows/main.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: CI/CD Pipeline
2+
3+
on:
4+
push:
5+
branches: [main]
6+
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- name: Get code
13+
uses: actions/checkout@v2
14+
15+
- name: Set up Node.js
16+
uses: actions/setup-node@v3
17+
with:
18+
node-version: '16'
19+
20+
- name: Install dependencies
21+
run: npm install
22+
23+
- name: Run tests
24+
run: npm test
25+
26+
- name: Build app
27+
run: npm run build
28+
29+
- name: Build Docker image
30+
run: docker build -t kishxrx/nodejs-demo-app:latest .
31+
32+
- name: Login to DockerHub
33+
run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin
34+
35+
- name: Push to DockerHub
36+
run: docker push kishxrx/nodejs-demo-app:latest

0 commit comments

Comments
 (0)