Skip to content

Commit f07c21c

Browse files
committed
[Chore] Configure GitHub Pages deployment for organization repo
1 parent d821803 commit f07c21c

10 files changed

Lines changed: 50 additions & 65 deletions

File tree

.github/workflows/nextjs.yml

Lines changed: 26 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,86 +1,57 @@
1-
# Sample workflow for building and deploying a Next.js site to GitHub Pages
2-
#
3-
# To get started with Next.js see: https://nextjs.org/docs/getting-started
4-
#
5-
name: Deploy Next.js site to Pages
1+
name: Deploy to GitHub Pages
62

73
on:
8-
# Runs on pushes targeting the default branch
94
push:
10-
branches: ["main"]
11-
12-
# Allows you to run this workflow manually from the Actions tab
5+
branches:
6+
- main
7+
- master
138
workflow_dispatch:
149

15-
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
1610
permissions:
1711
contents: read
1812
pages: write
1913
id-token: write
2014

21-
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
22-
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
2315
concurrency:
2416
group: "pages"
2517
cancel-in-progress: false
2618

2719
jobs:
28-
# Build job
2920
build:
3021
runs-on: ubuntu-latest
3122
steps:
3223
- name: Checkout
3324
uses: actions/checkout@v4
34-
- name: Detect package manager
35-
id: detect-package-manager
36-
run: |
37-
if [ -f "${{ github.workspace }}/yarn.lock" ]; then
38-
echo "manager=yarn" >> $GITHUB_OUTPUT
39-
echo "command=install" >> $GITHUB_OUTPUT
40-
echo "runner=yarn" >> $GITHUB_OUTPUT
41-
exit 0
42-
elif [ -f "${{ github.workspace }}/package.json" ]; then
43-
echo "manager=npm" >> $GITHUB_OUTPUT
44-
echo "command=ci" >> $GITHUB_OUTPUT
45-
echo "runner=npx --no-install" >> $GITHUB_OUTPUT
46-
exit 0
47-
else
48-
echo "Unable to determine package manager"
49-
exit 1
50-
fi
51-
- name: Setup Node
25+
26+
- name: Setup Bun
27+
uses: oven-sh/setup-bun@v2
28+
with:
29+
bun-version: latest
30+
31+
- name: Setup Node.js
5232
uses: actions/setup-node@v4
5333
with:
54-
node-version: "20"
55-
cache: ${{ steps.detect-package-manager.outputs.manager }}
34+
node-version: '20'
35+
36+
- name: Install dependencies
37+
run: bun install --frozen-lockfile
38+
39+
- name: Build
40+
env:
41+
NEXT_PUBLIC_BASE_PATH: /website
42+
run: bun run build
43+
44+
- name: Create .nojekyll file
45+
run: touch ./out/.nojekyll
46+
5647
- name: Setup Pages
5748
uses: actions/configure-pages@v5
58-
with:
59-
# Automatically inject basePath in your Next.js configuration file and disable
60-
# server side image optimization (https://nextjs.org/docs/api-reference/next/image#unoptimized).
61-
#
62-
# You may remove this line if you want to manage the configuration yourself.
63-
static_site_generator: next
64-
- name: Restore cache
65-
uses: actions/cache@v4
66-
with:
67-
path: |
68-
.next/cache
69-
# Generate a new cache whenever packages or source files change.
70-
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json', '**/yarn.lock') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }}
71-
# If source files changed but packages didn't, rebuild from a prior cache.
72-
restore-keys: |
73-
${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json', '**/yarn.lock') }}-
74-
- name: Install dependencies
75-
run: ${{ steps.detect-package-manager.outputs.manager }} ${{ steps.detect-package-manager.outputs.command }}
76-
- name: Build with Next.js
77-
run: ${{ steps.detect-package-manager.outputs.runner }} next build
49+
7850
- name: Upload artifact
7951
uses: actions/upload-pages-artifact@v3
8052
with:
8153
path: ./out
8254

83-
# Deployment job
8455
deploy:
8556
environment:
8657
name: github-pages
@@ -91,3 +62,4 @@ jobs:
9162
- name: Deploy to GitHub Pages
9263
id: deployment
9364
uses: actions/deploy-pages@v4
65+

app/layout.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import type React from "react"
22
import type { Metadata } from "next"
33

4-
import { Analytics } from "@vercel/analytics/next"
54
import { Header } from "@/components/header"
65
import { Footer } from "@/components/footer"
6+
import { basePath } from "@/lib/utils"
77
import "./globals.css"
88

99
import { Inter, Playfair_Display, JetBrains_Mono, Libre_Baskerville as V0_Font_Libre_Baskerville, IBM_Plex_Mono as V0_Font_IBM_Plex_Mono, Lora as V0_Font_Lora } from 'next/font/google'
@@ -21,7 +21,7 @@ export const metadata: Metadata = {
2121
title: "BreadCrumbs - A Modern Programming Language",
2222
description: "BreadCrumbs is a modern programming language for enthusiasts who love clean, expressive code.",
2323
icons: {
24-
icon: "/images/image-2025-12-24-01-58-31.png",
24+
icon: `${basePath}/images/logo.png`,
2525
},
2626
generator: 'v0.app'
2727
}
@@ -39,7 +39,6 @@ export default function RootLayout({
3939
<main className="flex-1">{children}</main>
4040
<Footer />
4141
</div>
42-
<Analytics />
4342
</body>
4443
</html>
4544
)

app/page.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import type React from "react"
2+
import { basePath } from "@/lib/utils"
23
import { CrumbButton } from "@/components/crumb-button"
34
import { Code, Zap, Users, BookOpen, ArrowRight } from "lucide-react"
45

@@ -11,8 +12,10 @@ export default function HomePage() {
1112
<div className="flex flex-col items-center text-center max-w-4xl mx-auto">
1213
<div className="mb-8 animate-in fade-in zoom-in duration-500">
1314
<img
14-
src="/images/image-2025-12-24-01-58-31.png"
15+
src={`${basePath}/images/logo.png`}
1516
alt="BreadCrumbs Logo"
17+
width={160}
18+
height={160}
1619
className="w-32 h-32 md:w-40 md:h-40 mx-auto"
1720
/>
1821
</div>

components/docs-sidebar.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import Link from "next/link"
44
import { usePathname } from "next/navigation"
5-
import { cn } from "@/lib/utils"
5+
import { cn, basePath } from "@/lib/utils"
66
import { docsConfig } from "@/lib/docs-config"
77
import { ChevronDown } from "lucide-react"
88
import { useState } from "react"
@@ -21,7 +21,7 @@ export function DocsSidebar() {
2121
<aside className="w-64 shrink-0 border-r border-border bg-sidebar hidden lg:block">
2222
<div className="sticky top-16 h-[calc(100vh-4rem)] overflow-y-auto p-4">
2323
<div className="flex items-center gap-2 mb-6 pb-4 border-b border-sidebar-border">
24-
<img src="/images/image-2025-12-24-01-58-31.png" alt="BreadCrumbs" className="w-8 h-8" />
24+
<img src={`${basePath}/images/logo.png`} alt="BreadCrumbs" width={32} height={32} />
2525
<span className="font-serif font-bold text-sidebar-foreground">BreadCrumbs</span>
2626
</div>
2727

components/footer.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import Link from "next/link"
2+
import { basePath } from "@/lib/utils"
23

34
export function Footer() {
45
return (
@@ -7,7 +8,7 @@ export function Footer() {
78
<div className="grid grid-cols-1 md:grid-cols-4 gap-8">
89
<div className="space-y-4">
910
<div className="flex items-center gap-2">
10-
<img src="/images/image-2025-12-24-01-58-31.png" alt="BreadCrumbs Logo" className="w-8 h-8" />
11+
<img src={`${basePath}/images/logo.png`} alt="BreadCrumbs Logo" width={32} height={32} />
1112
<span className="font-serif text-lg font-bold">BreadCrumbs</span>
1213
</div>
1314
<p className="text-sm text-muted-foreground leading-relaxed">

components/header.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import Link from "next/link"
44
import { usePathname } from "next/navigation"
55
import { ThemeToggle } from "./theme-toggle"
6-
import { cn } from "@/lib/utils"
6+
import { cn, basePath } from "@/lib/utils"
77
import { Menu, X } from "lucide-react"
88
import { useState } from "react"
99

@@ -26,9 +26,11 @@ export function Header() {
2626
<div className="flex items-center justify-between h-16">
2727
<Link href="/" className="flex items-center gap-2 group">
2828
<img
29-
src="/images/image-2025-12-24-01-58-31.png"
29+
src={`${basePath}/images/logo.png`}
3030
alt="BreadCrumbs Logo"
31-
className="w-10 h-10 transition-transform duration-300 group-hover:rotate-6"
31+
width={40}
32+
height={40}
33+
className="transition-transform duration-300 group-hover:rotate-6"
3234
/>
3335
<span className="font-serif text-xl font-bold text-foreground hidden sm:block">BreadCrumbs</span>
3436
</Link>

lib/utils.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,7 @@ import { twMerge } from 'tailwind-merge'
44
export function cn(...inputs: ClassValue[]) {
55
return twMerge(clsx(inputs))
66
}
7+
8+
// Base path for GitHub Pages
9+
// This should match the basePath in next.config.mjs
10+
export const basePath = process.env.NEXT_PUBLIC_BASE_PATH || '/website'

next.config.mjs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
/** @type {import('next').NextConfig} */
22
const nextConfig = {
3+
output: 'export',
34
devIndicators: false,
45
typescript: {
56
ignoreBuildErrors: true,
67
},
78
images: {
89
unoptimized: true,
910
},
11+
basePath: '/website',
12+
assetPrefix: '/website/',
1013
}
1114

1215
export default nextConfig

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
"build": "next build",
77
"dev": "next dev",
88
"lint": "eslint .",
9-
"start": "next start"
9+
"start": "next start",
10+
"export": "next build"
1011
},
1112
"dependencies": {
1213
"@hookform/resolvers": "^3.10.0",

public/images/image-2025-12-24-01-58-31.png renamed to public/images/logo.png

File renamed without changes.

0 commit comments

Comments
 (0)