Skip to content

Commit f8a149a

Browse files
committed
Changes for publishing site
1 parent 07ff02b commit f8a149a

File tree

2 files changed

+87
-1
lines changed

2 files changed

+87
-1
lines changed

.github/workflows/deploy.yml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# Workflow for building and deploying a Next.js site to GitHub Pages
2+
name: Deploy Next.js site to Pages
3+
4+
on:
5+
# Runs on pushes targeting the default branch
6+
push:
7+
branches: ["main"]
8+
9+
# Allows you to run this workflow manually from the Actions tab
10+
workflow_dispatch:
11+
12+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
13+
permissions:
14+
contents: read
15+
pages: write
16+
id-token: write
17+
18+
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
19+
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
20+
concurrency:
21+
group: "pages"
22+
cancel-in-progress: false
23+
24+
jobs:
25+
# Build job
26+
build:
27+
runs-on: ubuntu-latest
28+
steps:
29+
- name: Checkout
30+
uses: actions/checkout@v4
31+
- name: Detect Package Manager
32+
id: detect-package-manager
33+
run: |
34+
if [ -f "${{ github.workspace }}/yarn.lock" ]; then
35+
echo "manager=yarn" >> $GITHUB_OUTPUT
36+
echo "command=install" >> $GITHUB_OUTPUT
37+
exit 0
38+
elif [ -f "${{ github.workspace }}/package.json" ]; then
39+
echo "manager=npm" >> $GITHUB_OUTPUT
40+
echo "command=ci" >> $GITHUB_OUTPUT
41+
exit 0
42+
else
43+
echo "Unable to determine package manager"
44+
exit 1
45+
fi
46+
- name: Setup Node
47+
uses: actions/setup-node@v4
48+
with:
49+
node-version: "20"
50+
cache: ${{ steps.detect-package-manager.outputs.manager }}
51+
- name: Setup Pages
52+
uses: actions/configure-pages@v5
53+
- name: Install dependencies
54+
run: ${{ steps.detect-package-manager.outputs.manager }} ${{ steps.detect-package-manager.outputs.command }}
55+
- name: Build with Next.js
56+
run: ${{ steps.detect-package-manager.outputs.manager }} run build
57+
- name: Upload artifact
58+
uses: actions/upload-pages-artifact@v3
59+
with:
60+
path: ./out
61+
62+
# Deployment job
63+
deploy:
64+
environment:
65+
name: github-pages
66+
url: ${{ steps.deployment.outputs.page_url }}
67+
runs-on: ubuntu-latest
68+
needs: build
69+
steps:
70+
- name: Deploy to GitHub Pages
71+
id: deployment
72+
uses: actions/deploy-pages@v4

next.config.mjs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,18 @@
11
/** @type {import('next').NextConfig} */
2-
const nextConfig = {};
2+
const nextConfig = {
3+
// Configure Next.js to produce a static export
4+
output: 'export',
5+
6+
// Optional: Add a basePath if your site is served from a subdirectory.
7+
// Since your repository is BennettTaylor.github.io, you likely don't need this.
8+
// basePath: '/your-repo-name',
9+
10+
// Optional: Change the asset prefix for the same reason as basePath.
11+
// assetPrefix: '/your-repo-name/',
12+
13+
images: {
14+
unoptimized: true,
15+
}
16+
};
317

418
export default nextConfig;

0 commit comments

Comments
 (0)