From 506385d7408cb1dac43906e1b64e7e4b0e385a19 Mon Sep 17 00:00:00 2001 From: Ajay Kumar B R Date: Fri, 25 Oct 2024 15:45:27 -0400 Subject: [PATCH 1/3] deleted previous workflows --- .github/workflows/build.yml | 25 --------------------- .github/workflows/deploy.yml | 42 ------------------------------------ 2 files changed, 67 deletions(-) delete mode 100644 .github/workflows/build.yml delete mode 100644 .github/workflows/deploy.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml deleted file mode 100644 index c8b64f0e..00000000 --- a/.github/workflows/build.yml +++ /dev/null @@ -1,25 +0,0 @@ -name: Build on PR - -on: - pull_request: - branches: - - master - -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: Use Node.js - uses: actions/setup-node@v3 - with: - node-version: '20' - - - name: Install Dependencies - run: npm install - - - name: Generate prisma client - run: npm run db:generate - - - name: Run Build - run: npm run build diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml deleted file mode 100644 index acbed6e5..00000000 --- a/.github/workflows/deploy.yml +++ /dev/null @@ -1,42 +0,0 @@ -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: ./docker/Dockerfile.user - push: true - tags: 100xdevs/week-18-class:latest # Replace with your Docker Hub username and repository - - - name: Verify Pushed Image - run: docker pull 100xdevs/week-18-class:latest # Replace with your Docker Hub username and repository - - - name: Deploy to EC2 - uses: appleboy/ssh-action@master - with: - host: ${{ secrets.SSH_HOST }} - username: ${{ secrets.SSH_USERNAME }} - key: ${{ secrets.SSH_KEY }} - script: | - sudo docker pull 100xdevs/week-18-class:latest - sudo docker stop web-app || true - sudo docker rm web-app || true - sudo docker run -d --name web-app -p 3005:3000 100xdevs/week-18-class:latest \ No newline at end of file From 71e78d775025fc71ec87ba8a433ab3936db9ec20 Mon Sep 17 00:00:00 2001 From: Ajay Kumar B R Date: Fri, 25 Oct 2024 16:04:10 -0400 Subject: [PATCH 2/3] CI workflow added --- .github/workflows/build.yml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000..c8b64f0e --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,25 @@ +name: Build on PR + +on: + pull_request: + branches: + - master + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Use Node.js + uses: actions/setup-node@v3 + with: + node-version: '20' + + - name: Install Dependencies + run: npm install + + - name: Generate prisma client + run: npm run db:generate + + - name: Run Build + run: npm run build From f558dbe0387477186de6a509930cac486982e6fe Mon Sep 17 00:00:00 2001 From: Ajay Kumar B R Date: Fri, 25 Oct 2024 16:07:12 -0400 Subject: [PATCH 3/3] testing CI worrkflow --- apps/user-app/app/page.tsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/apps/user-app/app/page.tsx b/apps/user-app/app/page.tsx index 0288eb02..1f72d245 100644 --- a/apps/user-app/app/page.tsx +++ b/apps/user-app/app/page.tsx @@ -1,12 +1,14 @@ import { getServerSession } from "next-auth"; -import { redirect } from 'next/navigation' +import { redirect } from "next/navigation"; import { authOptions } from "./lib/auth"; +// testing the ci workflow + export default async function Page() { const session = await getServerSession(authOptions); if (session?.user) { - redirect('/dashboard') + redirect("/dashboard"); } else { - redirect('/api/auth/signin') + redirect("/api/auth/signin"); } }