Skip to content

Commit 0f95ae7

Browse files
authored
Merge pull request #41 from hngprojects/chore/ci-cd-pipeline
Chore/ci cd pipeline
2 parents d1d56ba + 2082e25 commit 0f95ae7

File tree

22 files changed

+370
-309
lines changed

22 files changed

+370
-309
lines changed

.github/workflows/frontend-cd.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Frontend Deploy
2+
3+
on:
4+
push:
5+
branches:
6+
- setup
7+
- main
8+
9+
jobs:
10+
deploy:
11+
runs-on: ubuntu-latest
12+
needs: [test-and-build]
13+
14+
steps:
15+
- name: Checkout Repository
16+
uses: actions/checkout@v4
17+
18+
- name: Download Build Artifacts
19+
uses: actions/download-artifact@v4
20+
with:
21+
name: next-build
22+
path: .next
23+
24+
- name: Install sshpass
25+
run: sudo apt-get install -y sshpass
26+
27+
- name: Deploy to Production Server
28+
run: |
29+
echo "🚀 Deploying .next build to server..."
30+
sshpass -p "${{ secrets.SERVER_PASSWORD }}" scp -o StrictHostKeyChecking=no -r .next package.json pnpm-lock.yaml \
31+
"${{ secrets.SERVER_USER }}@${{ secrets.SERVER_IP }}:/home/${{ secrets.SERVER_USER }}/AI-Ad-Gen-Frontend"
32+
33+
- name: Start Application on Server
34+
run: |
35+
sshpass -p "${{ secrets.SERVER_PASSWORD }}" ssh -o StrictHostKeyChecking=no \
36+
"${{ secrets.SERVER_USER }}@${{ secrets.SERVER_IP }}" << 'EOF'
37+
set -e # Stop script on error
38+
cd /home/${{ secrets.SERVER_USER }}/AI-Ad-Gen-Frontend
39+
pnpm install --frozen-lockfile
40+
pm2 delete ai-adgen-frontend || true
41+
pm2 start pnpm --name ai-adgen-frontend -- start
42+
EOF

.github/workflows/frontend-ci.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Frontend Test
2+
3+
on:
4+
push:
5+
branches:
6+
- setup
7+
- main
8+
9+
jobs:
10+
test-and-build:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout Repository
15+
uses: actions/checkout@v4
16+
17+
- name: Setup Node.js
18+
uses: actions/setup-node@v4
19+
with:
20+
node-version: "20.x"
21+
22+
- name: Setup pnpm
23+
uses: pnpm/action-setup@v3
24+
with:
25+
version: latest
26+
27+
- name: Install Dependencies
28+
run: pnpm install --frozen-lockfile
29+
30+
- name: Build Frontend
31+
run: pnpm build
32+
33+
- name: Upload Build Artifacts
34+
uses: actions/upload-artifact@v4
35+
with:
36+
name: next-build
37+
path: "${{ env.NEXT_PATH }}/*"
38+
if-no-files-found: error
39+
include-hidden-files: true

public/images/hng-wig-1.png

1.67 MB
Loading

public/images/hng-wig-2.png

1.41 MB
Loading

public/images/hng-wig-3.png

917 KB
Loading

src/app/ad-type/ad-type-selector.tsx

Lines changed: 0 additions & 171 deletions
This file was deleted.

src/app/ad-type/page.tsx

Lines changed: 0 additions & 18 deletions
This file was deleted.

src/app/ad-form/_components/ad-form.tsx renamed to src/app/create-ad/(formGroup)/ad-form/_components/ad-form.tsx

File renamed without changes.

src/app/ad-form/_components/image-ad-form.tsx renamed to src/app/create-ad/(formGroup)/ad-form/_components/image-ad-form.tsx

Lines changed: 1 addition & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import {
2222
import { Input } from "@/components/ui/input";
2323
import { Textarea } from "@/components/ui/textarea";
2424
import { Button } from "@/components/ui/button";
25-
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
2625
import {
2726
demographicsOptions,
2827
regionOptions,
@@ -31,7 +30,6 @@ import {
3130
ageGroupOptions,
3231
} from "@/app/constants/step-one-form-options";
3332
import { ImageAdSchema } from "@/schemas/ad-schema";
34-
import Image from "next/image";
3533
import Link from "next/link";
3634
import { useRouter } from "next/navigation";
3735
const DynamicMultiSelect = dynamic(
@@ -65,53 +63,6 @@ export const ImageAdForm = () => {
6563
};
6664

6765
return (
68-
<div className="min-h-full bg-[#F9FAFB] p-6 py-18 flex justify-center items-center">
69-
<Card className="w-full max-w-[890px]">
70-
<CardContent className="p-14">
71-
<div className="mb-8">
72-
<Link
73-
href="/ad-type"
74-
className="flex items-center text-gray-600 hover:text-gray-800 cursor-pointer p-0"
75-
>
76-
<Image
77-
src="/arrow-left.svg"
78-
alt="Back"
79-
className="w-5 h-5 mr-2"
80-
width={10}
81-
height={10}
82-
/>
83-
<span>Back</span>
84-
</Link>
85-
</div>
86-
87-
<CardHeader className="p-0 mb-6 text-center">
88-
<CardTitle className="text-2xl font-bold">
89-
Let&apos;s set up your Ad
90-
</CardTitle>
91-
<p className="text-gray-500 mt-2">
92-
Fill in the details below, then AI generates your ad instantly.
93-
</p>
94-
</CardHeader>
95-
96-
<div className="mb-8">
97-
<div className="flex justify-around items-center">
98-
<div className="text-center">
99-
<p className="text-sm text-black font-medium">STEP 1</p>
100-
<p className="text-xs mt-1 text-gray-700">Set Ad goals</p>
101-
</div>
102-
103-
<div className="text-center">
104-
<p className="text-sm text-gray-400 font-medium">STEP 2</p>
105-
<p className="text-xs mt-1 text-gray-400">Preview</p>
106-
</div>
107-
</div>
108-
109-
<div className="relative w-full h-2 bg-white-200 rounded-full mt-4 mb-4">
110-
<div className="absolute left-0 h-2 bg-[#1467C5] rounded-l-full w-[48%]"></div>
111-
112-
<div className="absolute right-0 h-2 bg-gray-300 rounded-r-full w-[48%]"></div>
113-
</div>
114-
</div>
11566

11667
<Form {...form}>
11768
<form onSubmit={form.handleSubmit(onSubmit)} className="space-y-6">
@@ -316,13 +267,10 @@ export const ImageAdForm = () => {
316267
: "bg-gray-300 text-gray-500 cursor-not-allowed"
317268
}`}
318269
>
319-
Generate Ad
270+
<Link href='/create-ad/preview'>Generate Ad</Link>
320271
</Button>
321272
</div>
322273
</form>
323274
</Form>
324-
</CardContent>
325-
</Card>
326-
</div>
327275
);
328276
};

src/app/ad-form/_components/video-ad-form.tsx renamed to src/app/create-ad/(formGroup)/ad-form/_components/video-ad-form.tsx

File renamed without changes.

0 commit comments

Comments
 (0)