diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 8aa0dea..0c13cfc 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -1,174 +1,177 @@ name: CI/CD Pipeline on: - push: - branches: - - main - pull_request: - branches: - - main + push: + branches: + - main + pull_request: + branches: + - main jobs: - code-quality: - runs-on: ubuntu-latest - env: - STORE_PATH: ~/.pnpm-store - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Install Node.js - uses: actions/setup-node@v4 - with: - node-version: 20 - - - uses: pnpm/action-setup@v4 - name: Install pnpm - with: - version: latest - run_install: false - - - name: Get pnpm store directory - shell: bash - run: | - echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV - - - uses: actions/cache@v4 - name: Setup pnpm cache - with: - path: ${{ env.STORE_PATH }} - key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} - restore-keys: | - ${{ runner.os }}-pnpm-store- - - - name: Install dependencies - run: pnpm install - - - name: Run ESLint - run: pnpm lint - - vulnerability-check: - runs-on: ubuntu-latest - env: - STORE_PATH: ~/.pnpm-store - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Install Node.js - uses: actions/setup-node@v4 - with: - node-version: 20 - - - uses: pnpm/action-setup@v4 - name: Install pnpm - with: - version: latest - run_install: false - - - name: Get pnpm store directory - shell: bash - run: | - echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV - - - uses: actions/cache@v4 - name: Setup pnpm cache - with: - path: ${{ env.STORE_PATH }} - key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} - restore-keys: | - ${{ runner.os }}-pnpm-store- - - - name: Install dependencies - run: pnpm install - - - name: Run Snyk to check for vulnerabilities - uses: snyk/actions/node@master - env: - SNYK_TOKEN: ${{ secrets.SNYK_TOKEN || '' }} - - build: - runs-on: ubuntu-latest - needs: [code-quality, vulnerability-check] + code-quality: + runs-on: ubuntu-latest + env: + STORE_PATH: ~/.pnpm-store + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install Node.js + uses: actions/setup-node@v4 + with: + node-version: 20 + + - uses: pnpm/action-setup@v4 + name: Install pnpm + with: + version: latest + run_install: false + + - name: Get pnpm store directory + shell: bash + run: | + echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV + + - uses: actions/cache@v4 + name: Setup pnpm cache + with: + path: ${{ env.STORE_PATH }} + key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} + restore-keys: | + ${{ runner.os }}-pnpm-store- + + - name: Install dependencies + run: pnpm install + + - name: Run ESLint + run: pnpm lint + vulnerability-check: + runs-on: ubuntu-latest + env: + STORE_PATH: ~/.pnpm-store + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install Node.js + uses: actions/setup-node@v4 + with: + node-version: 20 + + - uses: pnpm/action-setup@v4 + name: Install pnpm + with: + version: latest + run_install: false + + - name: Get pnpm store directory + shell: bash + run: | + echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV + + - uses: actions/cache@v4 + name: Setup pnpm cache + with: + path: ${{ env.STORE_PATH }} + key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} + restore-keys: | + ${{ runner.os }}-pnpm-store- + + - name: Install dependencies + run: pnpm install + + - name: Run Snyk to check for vulnerabilities + uses: snyk/actions/node@master env: - STORE_PATH: ~/.pnpm-store - - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Install Node.js - uses: actions/setup-node@v4 - with: - node-version: 20 - - - uses: pnpm/action-setup@v4 - name: Install pnpm - with: - version: latest - run_install: false - - - name: Get pnpm store directory - shell: bash - run: | - echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV - - - uses: actions/cache@v4 - name: Setup pnpm cache - with: - path: ${{ env.STORE_PATH }} - key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} - restore-keys: | - ${{ runner.os }}-pnpm-store- - - - name: Install dependencies - run: pnpm install - - - uses: actions/cache@v4 - with: - path: | - ~/.npm - ${{ github.workspace }}/.next/cache - key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('**/*.js', '**/*.jsx', '**/*.ts', '**/*.tsx') }} - restore-keys: | - ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}- - - - name: Build - run: pnpm build - - # dockerize: - # runs-on: ubuntu-latest - # needs: build - # steps: - # - name: Checkout code - # uses: actions/checkout@v2 - - # - name: Log in to Docker Hub - # run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin - - # - name: Build Docker image - # run: docker build -t myapp:latest . - - # - name: Push Docker image - # run: docker tag myapp:latest ${{ secrets.DOCKER_USERNAME }}/myapp:latest - # run: docker push ${{ secrets.DOCKER_USERNAME }}/myapp:latest - - # deploy: - # runs-on: ubuntu-latest - # needs: dockerize - # steps: - # - name: Checkout code - # uses: actions/checkout@v2 - - # - name: Deploy to VM - # uses: appleboy/ssh-action@v0.1.5 - # with: - # host: ${{ secrets.VM_HOST }} - # username: ${{ secrets.VM_USER }} - # key: ${{ secrets.VM_KEY }} - # script: | - # docker pull ${{ secrets.DOCKER_USERNAME }}/myapp:latest - # docker stop myapp || true - # docker rm myapp || true - # docker run -d --name myapp -p 80:80 ${{ secrets.DOCKER_USERNAME }}/myapp:latest \ No newline at end of file + SNYK_TOKEN: ${{ secrets.SNYK_TOKEN || '' }} + + build: + runs-on: ubuntu-latest + needs: [code-quality, vulnerability-check] + + env: + STORE_PATH: ~/.pnpm-store + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install Node.js + uses: actions/setup-node@v4 + with: + node-version: 20 + + - uses: pnpm/action-setup@v4 + name: Install pnpm + with: + version: latest + run_install: false + + - name: Get pnpm store directory + shell: bash + run: | + echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV + + - uses: actions/cache@v4 + name: Setup pnpm cache + with: + path: ${{ env.STORE_PATH }} + key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} + restore-keys: | + ${{ runner.os }}-pnpm-store- + + - name: Install dependencies + run: pnpm install + + # TODO: Cache not found error in the pipeline + # https://github.com/1oannis/homepage/actions/runs/11191028917/job/31113476680 + + - uses: actions/cache@v4 + with: + path: | + ~/.npm + ${{ github.workspace }}/.next/cache + key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('**/*.js', '**/*.jsx', '**/*.ts', '**/*.tsx') }} + restore-keys: | + ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}- + + - name: Build + run: pnpm build + + # dockerize: + # runs-on: ubuntu-latest + # needs: build + # steps: + # - name: Checkout code + # uses: actions/checkout@v2 + + # - name: Log in to Docker Hub + # run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin + + # - name: Build Docker image + # run: docker build -t myapp:latest . + + # - name: Push Docker image + # run: docker tag myapp:latest ${{ secrets.DOCKER_USERNAME }}/myapp:latest + # run: docker push ${{ secrets.DOCKER_USERNAME }}/myapp:latest + + # deploy: + # runs-on: ubuntu-latest + # needs: dockerize + # steps: + # - name: Checkout code + # uses: actions/checkout@v2 + + # - name: Deploy to VM + # uses: appleboy/ssh-action@v0.1.5 + # with: + # host: ${{ secrets.VM_HOST }} + # username: ${{ secrets.VM_USER }} + # key: ${{ secrets.VM_KEY }} + # script: | + # docker pull ${{ secrets.DOCKER_USERNAME }}/myapp:latest + # docker stop myapp || true + # docker rm myapp || true + # docker run -d --name myapp -p 80:80 ${{ secrets.DOCKER_USERNAME }}/myapp:latest diff --git a/app/(home)/about/page.tsx b/app/(home)/about/page.tsx new file mode 100644 index 0000000..c2028d2 --- /dev/null +++ b/app/(home)/about/page.tsx @@ -0,0 +1,10 @@ +import type { Metadata } from "next" + +export const metadata: Metadata = { + title: "About", + description: "This is the about page", +} + +export default function About() { + return

About

+} diff --git a/app/(home)/privacy/page.tsx b/app/(home)/privacy/page.tsx new file mode 100644 index 0000000..46f5fdd --- /dev/null +++ b/app/(home)/privacy/page.tsx @@ -0,0 +1,10 @@ +import type { Metadata } from "next" + +export const metadata: Metadata = { + title: "Privacy Policy", + description: "This is the privacy policy page", +} + +export default function Privacy() { + return

Privacy Policy

+} diff --git a/app/(home)/terms/page.tsx b/app/(home)/terms/page.tsx new file mode 100644 index 0000000..806ffab --- /dev/null +++ b/app/(home)/terms/page.tsx @@ -0,0 +1,10 @@ +import type { Metadata } from "next" + +export const metadata: Metadata = { + title: "Terms of Service", + description: "This is the terms of service page", +} + +export default function Terms() { + return

Terms of Service

+} diff --git a/app/layout.tsx b/app/layout.tsx index 3622571..72e0555 100644 --- a/app/layout.tsx +++ b/app/layout.tsx @@ -1,8 +1,11 @@ -import { open_sans } from "@/app/fonts" import "@/app/globals.css" -import Sidebar from "@/components/ui/sidebar" + +import type { Metadata } from "next" + +import { open_sans } from "@/app/fonts" +import Footer from "@/components/ui/footer" import Header from "@/components/ui/header" -import { Metadata } from "next"; +import Sidebar from "@/components/ui/sidebar" export const metadata: Metadata = { title: "Root Layout", @@ -18,25 +21,24 @@ export const metadata: Metadata = { type: "image/x-icon", url: "/favicon-dark.ico", media: "(prefers-color-scheme: dark)", - } + }, ], }, -}; +} export default function RootLayout({ children, }: Readonly<{ - children: React.ReactNode; + children: React.ReactNode }>) { return ( -
+
-
- {children} -
+
{children}
+
diff --git a/app/page.tsx b/app/page.tsx index 02bd0e1..c6f43dd 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -6,8 +6,5 @@ export const metadata: Metadata = { } export default function Home() { - return ( - <> - - ) + return

Homepage

} diff --git a/components/ui/footer.tsx b/components/ui/footer.tsx new file mode 100644 index 0000000..b9922aa --- /dev/null +++ b/components/ui/footer.tsx @@ -0,0 +1,37 @@ +import Link from "next/link" + +export default function Footer() { + return ( +
+
+
+
+

+ © 2024 Your Company. All rights reserved. +

+
+ +
+
+
+ ) +} diff --git a/components/ui/sidebar.tsx b/components/ui/sidebar.tsx index 9f629ff..316338b 100644 --- a/components/ui/sidebar.tsx +++ b/components/ui/sidebar.tsx @@ -1,70 +1,128 @@ "use client" +import { Home, PanelRightClose, Settings, Users } from "lucide-react" +import Image from "next/image" +import Link from "next/link" import React, { useState } from "react" -import { PanelRightClose, Home, Settings, Users } from "lucide-react" -import { cn } from "@/lib/utils" + import { Button } from "@/components/ui/button" -import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/components/ui/tooltip" -import Image from "next/image" +import { + Tooltip, + TooltipContent, + TooltipProvider, + TooltipTrigger, +} from "@/components/ui/tooltip" +import { cn } from "@/lib/utils" interface SidebarItemProps { - icon: React.ReactNode - label: string - isOpen: boolean + icon: React.ReactNode + label: string + isOpen: boolean + href: string } -function SidebarItem({ icon, label, isOpen }: SidebarItemProps) { - return ( - - - - - - {!isOpen && {label}} - - - ) +function SidebarItem({ icon, label, isOpen, href }: SidebarItemProps) { + return ( + + + + + + + + {!isOpen && {label}} + + + ) } -export default function Sidebar({ children }: Readonly<{ children: React.ReactNode }>) { - const [isSidebarOpen, setIsSidebarOpen] = useState(false) - const toggleSidebar = () => setIsSidebarOpen(!isSidebarOpen) +export default function Sidebar({ + children, +}: Readonly<{ children: React.ReactNode }>) { + const [isSidebarOpen, setIsSidebarOpen] = useState(false) + const toggleSidebar = () => setIsSidebarOpen(!isSidebarOpen) - return ( -
- {/* Sidebar */} - - {/* Main content */} -
- {children} -
+ return ( +
+ {/* Sidebar */} + + {/* Main content */} +
+ {children} +
+
+ ) }