Skip to content

Commit b43351d

Browse files
authored
Merge pull request #25 from quachtridat/develop
Fix GH Actions
2 parents aa27153 + 5391e04 commit b43351d

File tree

4 files changed

+57
-20
lines changed

4 files changed

+57
-20
lines changed

.github/workflows/build.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,20 @@ jobs:
2222
runs-on: ubuntu-latest
2323
steps:
2424
- name: Checkout
25-
uses: actions/checkout@v3
25+
uses: actions/checkout@v4
2626
- name: Setup Node v${{ env.NODE_VERSION }}
27-
uses: actions/setup-node@v3
27+
uses: actions/setup-node@v4
2828
with:
29+
cache: npm
2930
node-version: ${{ env.NODE_VERSION }}
3031
- name: Install Node packages
31-
run: npm ci
32+
run: npm install
33+
- name: Restore cache
34+
uses: actions/cache@v4
35+
with:
36+
path: .next/cache
37+
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }}
38+
restore-keys: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-
3239
- name: Linting check
3340
run: npm run lint
3441
- name: Build

.github/workflows/deploy.yml

Lines changed: 39 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,31 +6,56 @@ on:
66
- master
77
workflow_dispatch:
88

9+
permissions:
10+
contents: read
11+
pages: write
12+
id-token: write
13+
14+
concurrency:
15+
group: "pages"
16+
cancel-in-progress: false
17+
918
env:
1019
NODE_VERSION: 22
1120

1221
jobs:
13-
deploy:
14-
name: Deploy to GitHub Pages
22+
build:
23+
name: Build for GitHub Pages
1524
runs-on: ubuntu-latest
16-
environment: production
1725
steps:
1826
- name: Checkout
19-
uses: actions/checkout@v3
27+
uses: actions/checkout@v4
2028
- name: Setup Node v${{ env.NODE_VERSION }}
21-
uses: actions/setup-node@v3
29+
uses: actions/setup-node@v4
2230
with:
31+
cache: npm
2332
node-version: ${{ env.NODE_VERSION }}
2433
- name: Install Node packages
25-
run: npm ci
26-
- name: Linting check
27-
run: npm run lint
34+
run: npm install
35+
- name: Setup Pages
36+
id: setup_pages
37+
uses: actions/configure-pages@v5
38+
- name: Restore cache
39+
uses: actions/cache@v4
40+
with:
41+
path: .next/cache
42+
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }}
43+
restore-keys: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-
2844
- name: Build
2945
run: npm run build
30-
- name: Export
31-
run: npm run export
32-
- name: Deploy to GitHub Pages
33-
uses: JamesIves/github-pages-deploy-action@v4.3.3
46+
env:
47+
NEXTJS_BASE_PATH: ${{ steps.setup_pages.outputs.base_path }}
48+
- name: Upload artifact
49+
uses: actions/upload-pages-artifact@v3
3450
with:
35-
branch: gh-pages
36-
folder: out
51+
path: out
52+
deploy:
53+
environment:
54+
name: github-pages
55+
url: ${{ steps.deploy_pages.outputs.page_url }}
56+
runs-on: ubuntu-latest
57+
needs: build
58+
steps:
59+
- name: Deploy to GitHub Pages
60+
id: deploy_pages
61+
uses: actions/deploy-pages@v4

next.config.js

Lines changed: 0 additions & 3 deletions
This file was deleted.

next.config.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import type { NextConfig } from 'next';
2+
3+
const nextConfig: NextConfig = {
4+
basePath: process.env.NEXTJS_BASE_PATH,
5+
output: 'export',
6+
}
7+
8+
export default nextConfig;

0 commit comments

Comments
 (0)