Skip to content

Commit e4369ab

Browse files
committed
chore: separate deploy job from build
1 parent 195a107 commit e4369ab

File tree

5 files changed

+24
-21
lines changed

5 files changed

+24
-21
lines changed

.github/workflows/ci-cd.yml

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -39,19 +39,23 @@ jobs:
3939
NEXT_PUBLIC_API_URL=${{ secrets.NEXT_PUBLIC_API_URL }}
4040
NEXT_PUBLIC_BUILD_API_URL=${{ secrets.NEXT_PUBLIC_BUILD_API_URL }}
4141
42-
- name: Deploy to EC2
43-
uses: appleboy/ssh-action@v0.1.9
44-
with:
45-
host: ${{ secrets.EC2_HOST }}
46-
username: ${{ secrets.EC2_USER }}
47-
key: ${{ secrets.EC2_PRIVATE_KEY }}
48-
script: |
49-
# Pull the latest Docker image from Docker Hub
50-
docker pull ${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_REPOSITORY_NAME }}:latest
51-
52-
# Stop and remove the existing container (if any)
53-
docker stop frontend || true
54-
docker rm frontend || true
55-
56-
# Run the new container
57-
docker run -d --name frontend -p 3000:3000 ${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_REPOSITORY_NAME }}:latest
42+
deploy:
43+
needs : build
44+
runs-on: ubuntu-latest
45+
steps:
46+
- name: Deploy to EC2
47+
uses: appleboy/ssh-action@v0.1.9
48+
with:
49+
host: ${{ secrets.EC2_HOST }}
50+
username: ${{ secrets.EC2_USER }}
51+
key: ${{ secrets.EC2_PRIVATE_KEY }}
52+
script: |
53+
# Pull the latest Docker image from Docker Hub
54+
docker pull ${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_REPOSITORY_NAME }}:latest
55+
56+
# Stop and remove the existing container (if any)
57+
docker stop frontend || true
58+
docker rm frontend || true
59+
60+
# Run the new container
61+
docker run -d --name frontend -p 3000:3000 ${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_REPOSITORY_NAME }}:latest

src/app/page.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@ import ViewPollComponent from "@/components/poll/ViewPollComponent";
44
import { GetAllPolls } from "@/services/pollServices";
55
import { containerStyles } from "@/styles/styles";
66
import { Poll } from "@/types/Poll";
7-
import Link from "next/link";
87

9-
export const revalidate = 60;
8+
export const revalidate = 10;
109

1110

1211
export default async function Dashboard() {

src/app/polls/[pollId]/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { GetAllPolls, GetPollById } from "@/services/pollServices";
33
import { containerStyles } from "@/styles/styles";
44
import { Poll } from "@/types/Poll";
55

6-
export const revalidate = 60;
6+
export const revalidate = 10;
77

88
export async function generateStaticParams() {
99
const polls: Poll[] = await GetAllPolls();

src/app/polls/manage/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import ManagePollParent from "@/components/poll/manage/ManagePollParent";
33
import { GetAllPolls } from "@/services/pollServices";
44
import { Poll } from "@/types/Poll";
55

6-
export const revalidate = 60;
6+
export const revalidate = 10;
77

88
export default async function ManagePoll() {
99

src/app/polls/statistics/[pollId]/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { GetAllPolls, GetPollById } from "@/services/pollServices";
33
import StatisticsComponent from "@/components/poll/statistics/StatisticsComponent";
44

55

6-
export const revalidate = 60;
6+
export const revalidate = 10;
77

88
export async function generateStaticParams() {
99
const polls: Poll[] = await GetAllPolls();

0 commit comments

Comments
 (0)