Skip to content

Commit 777a179

Browse files
committed
chore: SSG 배포 적용 및 github pages로 배포
1 parent eb5e502 commit 777a179

4 files changed

Lines changed: 34 additions & 48 deletions

File tree

.github/workflows/LINT_CHECK.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
name: lint-action
22

33
on:
4-
push:
5-
branches: ['main', 'develop']
64
pull_request:
75
branches: ['main', develop]
86

.github/workflows/nextjs.yml

Lines changed: 29 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,86 +1,70 @@
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-
#
51
name: Deploy Next.js site to Pages
62

73
on:
8-
# Runs on pushes targeting the default branch
94
push:
10-
branches: ["develop"]
11-
12-
# Allows you to run this workflow manually from the Actions tab
5+
branches:
6+
- develop
137
workflow_dispatch:
8+
inputs:
9+
branch:
10+
description: 'Deploy branch'
11+
required: true
12+
default: 'develop'
13+
type: choice
14+
options:
15+
- develop
1416

15-
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
1617
permissions:
1718
contents: read
1819
pages: write
1920
id-token: write
2021

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.
2322
concurrency:
24-
group: "pages"
23+
group: 'pages'
2524
cancel-in-progress: false
2625

2726
jobs:
28-
# Build job
2927
build:
3028
runs-on: ubuntu-latest
3129
steps:
3230
- name: Checkout
3331
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
32+
33+
- name: Setup pnpm
34+
uses: pnpm/action-setup@v4
35+
with:
36+
version: 10
37+
5138
- name: Setup Node
5239
uses: actions/setup-node@v4
5340
with:
54-
node-version: "20"
55-
cache: ${{ steps.detect-package-manager.outputs.manager }}
41+
node-version: '22'
42+
cache: 'pnpm'
43+
5644
- name: Setup Pages
5745
uses: actions/configure-pages@v5
5846
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.
6347
static_site_generator: next
48+
6449
- name: Restore cache
6550
uses: actions/cache@v4
6651
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.
52+
path: .next/cache
53+
key: ${{ runner.os }}-nextjs-${{ hashFiles('pnpm-lock.yaml') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }}
7254
restore-keys: |
73-
${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json', '**/yarn.lock') }}-
55+
${{ runner.os }}-nextjs-${{ hashFiles('pnpm-lock.yaml') }}-
56+
7457
- name: Install dependencies
75-
run: ${{ steps.detect-package-manager.outputs.manager }} ${{ steps.detect-package-manager.outputs.command }}
58+
run: pnpm install --frozen-lockfile
59+
7660
- name: Build with Next.js
77-
run: ${{ steps.detect-package-manager.outputs.runner }} next build
61+
run: pnpm run build
62+
7863
- name: Upload artifact
7964
uses: actions/upload-pages-artifact@v3
8065
with:
8166
path: ./out
8267

83-
# Deployment job
8468
deploy:
8569
environment:
8670
name: github-pages

next.config.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
import type { NextConfig } from 'next';
22

33
const nextConfig: NextConfig = {
4+
output: 'export',
5+
46
reactStrictMode: true,
57

68
reactCompiler: true,
79

810
images: {
11+
unoptimized: true,
912
deviceSizes: [640, 768, 1024, 1280, 1440, 1600, 1920],
1013
formats: ['image/avif', 'image/webp'],
1114
remotePatterns: [

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
"build": "next build",
88
"start:serve": "next start",
99
"lint": "pnpm exec eslint .",
10-
"lint:fix": "pnpm exec eslint . --fix"
10+
"lint:fix": "pnpm exec eslint . --fix",
11+
"typecheck": "tsc --noEmit"
1112
},
1213
"dependencies": {
1314
"clsx": "^2.1.1",

0 commit comments

Comments
 (0)