Skip to content

Commit 79a896f

Browse files
authored
Merge pull request #2 from S1J2-Lab/chore/#1-ci-cd-구축
[chore] CI/CD 파이프라인 구축 (#1)
2 parents 1d8fec2 + ea8336d commit 79a896f

6 files changed

Lines changed: 87 additions & 3 deletions

File tree

.github/ISSUE_TEMPLATE/issue-template.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
---
22
name: Issue Template
33
about: 이슈를 생성할 때 사용해주세요.
4-
title: "[type] "
4+
title: '[type] '
55
labels: ''
66
assignees: ''
77
type: Feature
8-
98
---
109

1110
## 📄 이슈 설명

.github/workflows/front-deploy.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Frontend Deploy
2+
3+
on:
4+
push:
5+
branches: [main]
6+
# main에 머지(push)될 때 실행
7+
8+
jobs:
9+
deploy:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
- run: corepack enable
14+
# package.json의 packageManager 버전(yarn berry)으로 자동 전환
15+
16+
- uses: actions/setup-node@v4
17+
with:
18+
node-version: 22
19+
cache: yarn
20+
21+
- run: yarn install --immutable
22+
- run: yarn build
23+
# dist/ 폴더 생성
24+
25+
- uses: aws-actions/configure-aws-credentials@v4
26+
with:
27+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
28+
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
29+
aws-region: ${{ secrets.AWS_REGION }}
30+
# GitHub Secrets에 저장한 AWS 키로 인증
31+
32+
- name: S3 업로드
33+
run: aws s3 sync dist/ s3://${{ secrets.S3_BUCKET }} --delete
34+
# dist/ 폴더를 S3에 동기화
35+
# --delete: S3에만 있고 dist/에 없는 파일은 삭제 (이전 빌드 파일 정리)
36+
37+
- name: CloudFront 캐시 무효화
38+
run: |
39+
aws cloudfront create-invalidation \
40+
--distribution-id ${{ secrets.CLOUDFRONT_DISTRIBUTION_ID }} \
41+
--paths "/*"
42+
# 전체 캐시 무효화 → 사용자가 새 빌드 파일을 즉시 받을 수 있게

.github/workflows/pr-ci.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: PR CI
2+
# GitHub Actions 탭에 표시되는 이름
3+
4+
on:
5+
pull_request:
6+
# base branch 제한 없이 PR이면 CI 수행
7+
8+
jobs:
9+
check:
10+
runs-on: ubuntu-latest
11+
# GitHub이 제공하는 우분투 서버에서 실행
12+
steps:
13+
- uses: actions/checkout@v4
14+
# 레포 코드를 서버에 내려받기
15+
16+
- run: corepack enable
17+
# package.json의 packageManager 버전(yarn berry)으로 자동 전환
18+
19+
- uses: actions/setup-node@v4
20+
with:
21+
node-version: 22
22+
cache: yarn
23+
# Node.js 22 설치, yarn 캐시 활성화 (두 번째 실행부터 빠름)
24+
25+
- run: yarn install --immutable
26+
# yarn.lock 기준으로 설치, lock 파일 변경 불가 (CI 안전장치)
27+
28+
- run: yarn lint
29+
# ESLint 검사 (console.log 등 룰 위반 시 실패)
30+
31+
- run: yarn format:check
32+
# Prettier 포맷 검사 (포맷 안 맞으면 실패)
33+
34+
- run: yarn build
35+
# TypeScript 타입체크 + Vite 빌드 (둘 중 하나라도 실패하면 머지 불가)
36+
37+
# - run: yarn test
38+
# 테스트 추가되면 활성화

.prettierignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
dist
2+
.yarn
3+
.pnp.cjs
4+
.pnp.loader.mjs

eslint.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import tseslint from 'typescript-eslint';
66
import { defineConfig, globalIgnores } from 'eslint/config';
77

88
export default defineConfig([
9-
globalIgnores(['dist']),
9+
globalIgnores(['dist', '.yarn/', '.pnp.cjs', '.pnp.loader.mjs']),
1010
{
1111
files: ['**/*.{ts,tsx}'],
1212
extends: [

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"dev": "vite",
88
"build": "tsc -b && vite build",
99
"lint": "eslint .",
10+
"format:check": "prettier --check .",
1011
"preview": "vite preview",
1112
"prepare": "husky"
1213
},

0 commit comments

Comments
 (0)