Skip to content

Commit f541fe3

Browse files
committed
Initial GH-Pages setup.
1 parent d83ca3b commit f541fe3

File tree

4 files changed

+122
-4
lines changed

4 files changed

+122
-4
lines changed

.github/workflows/deploy.yml

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
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
6+
7+
on:
8+
# Runs on pushes targeting the default branch
9+
push:
10+
branches: ["main"]
11+
12+
# Allows you to run this workflow manually from the Actions tab
13+
workflow_dispatch:
14+
15+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
16+
permissions:
17+
contents: read
18+
pages: write
19+
id-token: write
20+
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.
23+
concurrency:
24+
group: "pages"
25+
cancel-in-progress: false
26+
27+
jobs:
28+
# Build job
29+
build:
30+
runs-on: ubuntu-latest
31+
steps:
32+
- name: Checkout
33+
uses: actions/checkout@v4
34+
35+
- name: Detect package manager
36+
id: detect-package-manager
37+
run: |
38+
if [ -f "${{ github.workspace }}/yarn.lock" ]; then
39+
echo "manager=yarn" >> $GITHUB_OUTPUT
40+
echo "command=install" >> $GITHUB_OUTPUT
41+
echo "runner=yarn" >> $GITHUB_OUTPUT
42+
exit 0
43+
elif [ -f "${{ github.workspace }}/package.json" ]; then
44+
echo "manager=npm" >> $GITHUB_OUTPUT
45+
echo "command=ci" >> $GITHUB_OUTPUT
46+
echo "runner=npx --no-install" >> $GITHUB_OUTPUT
47+
exit 0
48+
else
49+
echo "Unable to determine package manager"
50+
exit 1
51+
fi
52+
53+
- name: Setup Node
54+
uses: actions/setup-node@v4
55+
with:
56+
node-version: "lts/*"
57+
cache: ${{ steps.detect-package-manager.outputs.manager }}
58+
59+
- name: Setup Pages
60+
uses: actions/configure-pages@v4
61+
62+
- name: Restore cache
63+
uses: actions/cache@v4
64+
with:
65+
path: |
66+
.next/cache
67+
# Generate a new cache whenever packages or source files change.
68+
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json', '**/yarn.lock') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }}
69+
# If source files changed but packages didn't, rebuild from a prior cache.
70+
restore-keys: |
71+
${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json', '**/yarn.lock') }}-
72+
73+
- name: Install dependencies
74+
run: ${{ steps.detect-package-manager.outputs.manager }} ${{ steps.detect-package-manager.outputs.command }}
75+
76+
- name: Build with Next.js
77+
run: ${{ steps.detect-package-manager.outputs.runner }} next build
78+
79+
- name: Upload artifact
80+
uses: actions/upload-pages-artifact@v3
81+
with:
82+
path: ./out
83+
84+
# Deployment job
85+
deploy:
86+
environment:
87+
name: github-pages
88+
url: ${{ steps.deployment.outputs.page_url }}
89+
runs-on: ubuntu-latest
90+
needs: build
91+
steps:
92+
- name: Deploy to GitHub Pages
93+
id: deployment
94+
uses: actions/deploy-pages@v4

app/page.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export default function Home() {
1717
>
1818
By{" "}
1919
<Image
20-
src="/vercel.svg"
20+
src="/pelita-ciview/vercel.svg"
2121
alt="Vercel Logo"
2222
className="dark:invert"
2323
width={100}
@@ -31,7 +31,7 @@ export default function Home() {
3131
<div className="relative z-[-1] flex place-items-center before:absolute before:h-[300px] before:w-full before:-translate-x-1/2 before:rounded-full before:bg-gradient-radial before:from-white before:to-transparent before:blur-2xl before:content-[''] after:absolute after:-z-20 after:h-[180px] after:w-full after:translate-x-1/3 after:bg-gradient-conic after:from-sky-200 after:via-blue-200 after:blur-2xl after:content-[''] before:dark:bg-gradient-to-br before:dark:from-transparent before:dark:to-blue-700 before:dark:opacity-10 after:dark:from-sky-900 after:dark:via-[#0141ff] after:dark:opacity-40 sm:before:w-[480px] sm:after:w-[240px] before:lg:h-[360px]">
3232
<Image
3333
className="relative dark:drop-shadow-[0_0_0.3rem_#ffffff70] dark:invert"
34-
src="/next.svg"
34+
src="/pelita-ciview/next.svg"
3535
alt="Next.js Logo"
3636
width={180}
3737
height={37}

next.config.mjs

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,28 @@
11
/** @type {import('next').NextConfig} */
2-
const nextConfig = {};
2+
const nextConfig = {
3+
/**
4+
* Enable static exports for the App Router.
5+
*
6+
* @see https://nextjs.org/docs/app/building-your-application/deploying/static-exports
7+
*/
8+
output: "export",
39

4-
export default nextConfig;
10+
/**
11+
* Set base path. This is the slug of your GitHub repository.
12+
*
13+
* @see https://nextjs.org/docs/app/api-reference/next-config-js/basePath
14+
*/
15+
basePath: "/nextjs-github-pages",
16+
17+
/**
18+
* Disable server-based image optimization. Next.js does not support
19+
* dynamic features with static exports.
20+
*
21+
* @see https://nextjs.org/docs/app/api-reference/components/image#unoptimized
22+
*/
23+
images: {
24+
unoptimized: true,
25+
},
26+
};
27+
28+
export default nextConfig;

public/.nojekyll

Whitespace-only changes.

0 commit comments

Comments
 (0)