Skip to content

Commit 8c75c5b

Browse files
author
thaddeus
committed
Add Next.js source files for GitHub Actions build
- Add package.json and package-lock.json (GitHub Actions needs these) - Add Next.js config files (next.config.js, tailwind.config.js, tsconfig.json) - Add src/ directory with all Next.js source code - Add proper GitHub Actions workflow for Next.js builds - This fixes the 'Dependencies lock file not found' error All 14 articles are now in src/app/guides/ and will be built by GitHub Actions
1 parent 9f63491 commit 8c75c5b

File tree

30 files changed

+15059
-0
lines changed

30 files changed

+15059
-0
lines changed

.github/workflows/nextjs.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# GitHub Actions workflow for Next.js deployment to GitHub Pages
2+
name: Deploy Next.js site to Pages
3+
4+
on:
5+
push:
6+
branches: ["main"]
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: read
11+
pages: write
12+
id-token: write
13+
14+
concurrency:
15+
group: "pages"
16+
cancel-in-progress: false
17+
18+
jobs:
19+
build:
20+
runs-on: ubuntu-latest
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v4
24+
- name: Setup Node.js
25+
uses: actions/setup-node@v4
26+
with:
27+
node-version: "18"
28+
cache: npm
29+
- name: Setup Pages
30+
uses: actions/configure-pages@v4
31+
with:
32+
static_site_generator: next
33+
- name: Restore cache
34+
uses: actions/cache@v3
35+
with:
36+
path: .next/cache
37+
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }}
38+
restore-keys: |
39+
${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-
40+
- name: Install dependencies
41+
run: npm ci
42+
- name: Build with Next.js
43+
run: npm run build
44+
- name: Upload artifact
45+
uses: actions/upload-pages-artifact@v3
46+
with:
47+
path: ./out
48+
49+
deploy:
50+
environment:
51+
name: github-pages
52+
url: ${{ steps.deployment.outputs.page_url }}
53+
runs-on: ubuntu-latest
54+
needs: build
55+
steps:
56+
- name: Deploy to GitHub Pages
57+
id: deployment
58+
uses: actions/deploy-pages@v4

next.config.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/** @type {import('next').NextConfig} */
2+
const nextConfig = {
3+
output: 'export',
4+
trailingSlash: true,
5+
images: {
6+
unoptimized: true
7+
},
8+
basePath: '',
9+
assetPrefix: '',
10+
}
11+
12+
module.exports = nextConfig

0 commit comments

Comments
 (0)