Skip to content

Commit 1991358

Browse files
committed
ci(github): add frontend CI workflow for build and cache (#129)
1 parent 7cdff89 commit 1991358

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

.github/workflows/frontend-ci.yml

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Frontend CI
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
paths:
7+
- 'frontend/**'
8+
pull_request:
9+
branches: [ main ]
10+
paths:
11+
- 'frontend/**'
12+
workflow_dispatch:
13+
14+
jobs:
15+
build:
16+
name: Install and Build Frontend
17+
runs-on: ubuntu-latest
18+
19+
defaults:
20+
run:
21+
working-directory: ./frontend
22+
23+
steps:
24+
- name: Checkout repository
25+
uses: actions/checkout@v3
26+
27+
- name: Setup Node.js
28+
uses: actions/setup-node@v3
29+
with:
30+
node-version: '18'
31+
cache: 'npm'
32+
cache-dependency-path: './frontend/package-lock.json'
33+
34+
- name: Install dependencies
35+
run: npm ci
36+
37+
- name: Build frontend
38+
run: npm run build
39+
40+
- name: Cache build artifacts
41+
uses: actions/cache@v3
42+
with:
43+
path: |
44+
./frontend/.next
45+
./frontend/node_modules
46+
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-${{ github.sha }}
47+
restore-keys: |
48+
${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-

0 commit comments

Comments
 (0)