Skip to content
17 changes: 17 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Deploy # can be named anything

on:
push:
branches: [ "main" ]

jobs:
deploy: # can be named anything

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4 # checkout to the feature branch for performing actions
- run: docker build . -t rohitkumar7905/next-js-app-for-cicd
- run: echo "${{secrets.DOCKERHUB_PASSWORD}}" | docker login -u ${{secrets.DOCKERHUB_USERNAME}} --password-stdin
# echo se value ko store krnge or stdin ke input me dedenge
- run: docker push rohitkumar7905/next-js-app-for-cicd
34 changes: 18 additions & 16 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

name: Integration
name: integration # can be named anything

on:
push:
Expand All @@ -8,7 +8,7 @@ on:
branches: [ "main" ]

jobs:
build:
build: # can be named anything

runs-on: ubuntu-latest

Expand All @@ -17,19 +17,18 @@ jobs:
node-version: [18.x, 20.x, 22.x]

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v4 # checkout to the feature branch for performing actions
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: "Installing Dependencies"
run: npm i
- name: Install dependencies # this is optional only for readability
run: npm install

- name: "Build command"
run: npm run build
- run: npm run build

unit-tests:
unit-tests: # can be named anything

runs-on: ubuntu-latest

Expand All @@ -38,14 +37,17 @@ jobs:
node-version: [18.x, 20.x, 22.x]

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v4 # checkout to the feature branch for performing actions
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: "Installing Dependencies"
run: npm i

- name: "Running test cases"
run: npm run test
- name: Install dependencies # this is optional only for readability
run: npm install

- name: "Run Unit Tests"
run: npm run test

# Branch Protection Rule (if want to if all passed then only show merge button)
# go to setting of repo -> branhes -> add rule for main(target brach) branch -> select require status checks to pass before merging
9 changes: 8 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.