diff --git a/.gitea/build-push.yml b/.gitea/build-push.yml new file mode 100644 index 0000000..949eab6 --- /dev/null +++ b/.gitea/build-push.yml @@ -0,0 +1,28 @@ +name: Build and Push Docker Image +on: + push: + branches: + - main + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Log in to Gitea Docker Registry + run: echo "${{ secrets.GITEA_PAT }}" | docker login ${{ secrets.GITEA_SERVER }} -u ${{ secrets.GITEA_USER }} --password-stdin + + - name: Build and push Docker image + uses: docker/build-push-action@v3 + with: + context: . + push: true + tags: ${{ env.GITEA_SERVER }}/${{ env.GITEA_USER }}/${{ env.GITEA_REPO }}:${{ env.IMAGE_TAG }} + + - name: Log out from Gitea Docker Registry + run: docker logout ${{ env.GITEA_SERVER }} \ No newline at end of file diff --git a/build-push.sh b/build-push.sh new file mode 100755 index 0000000..ef08376 --- /dev/null +++ b/build-push.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +# Load environment variables from .env file +if [ -f .env ]; then + export $(grep -v '^#' .env | xargs) +else + echo "Error: .env file not found!" + exit 1 +fi + +# Ensure Docker is logged in using non-interactive mode +echo "$GITEA_PAT" | docker login $GITEA_SERVER -u $GITEA_USER --password-stdin + +# Build and tag the Docker image +docker build -t $GITEA_SERVER/$GITEA_USER/$GITEA_REPO:$IMAGE_TAG . + +# Push the image +DOCKER_CLI_EXPERIMENTAL=enabled docker --log-level debug push $GITEA_SERVER/$GITEA_USER/$GITEA_REPO:$IMAGE_TAG + +# Logout to prevent credential storage +docker logout $GITEA_SERVER + +echo "Docker image pushed successfully!" diff --git a/src/app/blog/page.tsx b/src/app/blog/page.tsx index 64f0ae9..a49be3a 100644 --- a/src/app/blog/page.tsx +++ b/src/app/blog/page.tsx @@ -12,10 +12,12 @@ export async function generateStaticParams() { export default async function BlogPage() { const postFolders = fs.readdirSync(postsDirectory); - const posts = postFolders.map((slug) => { - const { title, description } = require(`./posts/${slug}/page.tsx`); - return { slug, title, description }; - }); + const posts = await Promise.all( + postFolders.map(async (slug) => { + const { title, description } = await import(`./posts/${slug}/metadata.ts`); + return { slug, title, description }; + }) + ); return (
diff --git a/src/app/blog/posts/example/metadata.ts b/src/app/blog/posts/example/metadata.ts new file mode 100644 index 0000000..552a28b --- /dev/null +++ b/src/app/blog/posts/example/metadata.ts @@ -0,0 +1,2 @@ +export const title = "Example Blog Post"; +export const description = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."; diff --git a/src/app/blog/posts/example/page.tsx b/src/app/blog/posts/example/page.tsx index e05e433..87214bc 100644 --- a/src/app/blog/posts/example/page.tsx +++ b/src/app/blog/posts/example/page.tsx @@ -1,13 +1,16 @@ -// /blog/posts/example/page.tsx -export const title = "Example Blog Post"; -export const description = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."; +import Head from 'next/head'; +import { title, description } from './metadata'; export default function ExamplePost() { return (
+ + {title} + +

{title}

{description}

Here is the full content of the blog post.

); -} +} \ No newline at end of file diff --git a/src/app/blog/posts/example2/metadata.ts b/src/app/blog/posts/example2/metadata.ts new file mode 100644 index 0000000..bb98739 --- /dev/null +++ b/src/app/blog/posts/example2/metadata.ts @@ -0,0 +1,2 @@ +export const title = "Example Blog Post 2"; +export const description = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."; diff --git a/src/app/blog/posts/example2/page.tsx b/src/app/blog/posts/example2/page.tsx index e5ddb5a..c1d51e4 100644 --- a/src/app/blog/posts/example2/page.tsx +++ b/src/app/blog/posts/example2/page.tsx @@ -1,13 +1,16 @@ -// /blog/posts/example/page.tsx -export const title = "Example Blog Post 2"; -export const description = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."; +import Head from 'next/head'; +import { title, description } from './metadata'; export default function ExamplePost() { return (
+ + {title} + +

{title}

{description}

-

Here is the full content of the blog post.

+

Here is the full content of the blog post. #2

); -} +} \ No newline at end of file diff --git a/src/app/layout.tsx b/src/app/layout.tsx index d4c8bee..3163bb8 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -5,7 +5,8 @@ import Head from "next/head"; const open_sans = Open_Sans({ weight: '500', - display: 'swap' + display: 'swap', + subsets: ["latin"] }) export const metadata: Metadata = { diff --git a/src/app/page.tsx b/src/app/page.tsx index 5223386..a4c76aa 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -1,4 +1,3 @@ -import Image from "next/image"; import Link from "next/link"; import { LuExternalLink } from "react-icons/lu"; @@ -8,10 +7,10 @@ export default function Home() {
- Hi, I'm Asher 👋 + Hi, I'm Asher 👋

- I'm a Year 12 student passionate about software engineering and problem-solving. Studying Economics, Computing, Maths, and Chemistry, I enjoy coding, tackling challenges, and building practical solutions. + I'm a Year 12 student passionate about software engineering and problem-solving. Studying Economics, Computing, Maths, and Chemistry, I enjoy coding, tackling challenges, and building practical solutions. This site is where I share my projects, ideas, and experiences.