Skip to content

Commit 9337e7a

Browse files
committed
add github workflows
1 parent 0c6f37f commit 9337e7a

File tree

3 files changed

+78
-2
lines changed

3 files changed

+78
-2
lines changed

.github/workflows/publish.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: publish-to-github-pages
2+
on:
3+
push:
4+
branches:
5+
- main
6+
7+
permissions:
8+
contents: read
9+
pages: write
10+
id-token: write
11+
12+
concurrency:
13+
group: 'pages'
14+
cancel-in-progress: false
15+
16+
jobs:
17+
build:
18+
runs-on: ubuntu-latest
19+
20+
steps:
21+
- name: Checkout 🛎️
22+
uses: actions/checkout@v4
23+
24+
- name: Setup Node.js ⚙️ - Cache dependencies ⚡ - Install dependencies 🔧
25+
uses: ./.github/workflows/setup-node
26+
27+
- name: Setup Pages ⚙️
28+
uses: actions/configure-pages@v4
29+
with:
30+
static_site_generator: next
31+
32+
- name: Build with Next.js 🏗️
33+
run: npx next build
34+
35+
- name: Upload artifact 📡
36+
uses: actions/upload-pages-artifact@v3
37+
with:
38+
path: ./out
39+
40+
deploy:
41+
environment:
42+
name: github-pages
43+
url: ${{ steps.deployment.outputs.page_url }}
44+
45+
runs-on: ubuntu-latest
46+
needs: build
47+
48+
steps:
49+
- name: Publish to GitHub Pages 🚀
50+
id: deployment
51+
uses: actions/deploy-pages@v4
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: setup-node
2+
description: 'Setup Node.js ⚙️ - Cache dependencies ⚡ - Install dependencies 🔧'
3+
runs:
4+
using: 'composite'
5+
steps:
6+
- name: Setup Node.js ⚙️
7+
uses: actions/setup-node@v4
8+
with:
9+
node-version: 20
10+
11+
- name: Cache dependencies ⚡
12+
id: cache_dependencies
13+
uses: actions/cache@v3
14+
with:
15+
path: node_modules
16+
key: node-modules-${{ hashFiles('package-lock.json') }}
17+
18+
- name: Install dependencies 🔧
19+
shell: bash
20+
if: steps.cache_dependencies.outputs.cache-hit != 'true'
21+
run: npm ci

next.config.mjs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
/** @type {import('next').NextConfig} */
2-
const nextConfig = {};
2+
const nextConfig = {
3+
basePath: '/next',
4+
output: 'export', // <=== enables static exports
5+
reactStrictMode: true,
6+
};
37

4-
export default nextConfig;
8+
module.exports = nextConfig;

0 commit comments

Comments
 (0)