-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14 from Somnath-Chattaraj/test2
Add CI/CD pipeline
- Loading branch information
Showing
2 changed files
with
74 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
name: Build and Migrate | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: '20' | ||
cache: 'npm' | ||
|
||
- name: Navigate to backend directory | ||
run: cd backend | ||
|
||
- name: Install dependencies | ||
run: npm install | ||
working-directory: backend | ||
|
||
- name: Build code | ||
run: npm run build | ||
working-directory: backend | ||
|
||
- name: Set up Prisma | ||
run: npx prisma generate | ||
working-directory: backend | ||
|
||
- name: Run Prisma Migrate | ||
env: | ||
DATABASE_URL: ${{ secrets.DATABASE_URL }} | ||
run: npx prisma migrate deploy | ||
working-directory: backend |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
name: Build and Deploy to Docker Hub | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
build-and-push: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check Out Repo | ||
uses: actions/checkout@v2 | ||
|
||
- name: Log in to Docker Hub | ||
uses: docker/login-action@v1 | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
|
||
- name: Build and Push Docker image | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: . | ||
file: ./backend/Dockerfile | ||
push: true | ||
tags: somnath910/statuscode1:latest # Replace with your Docker Hub username and repository | ||
|
||
- name: Verify Pushed Image | ||
run: docker pull somnath910/statuscode1:latest # Replace with your Docker Hub username and repository |