Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
137 changes: 137 additions & 0 deletions .github/workflows/ci-cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
name: CI/CD Workflow

on:
push:
branches:
- main
- develop
- "feat/**"
- "fix/**"
- "refactor/**"
- "style/**"
pull_request:
branches:
- develop

permissions:
contents: read
pull-requests: write

jobs:
# 0️⃣ Lint
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 10
- name: Node.js
uses: actions/setup-node@v4
with:
node-version: "22"
cache: "pnpm"
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Run lint
run: pnpm lint

# 1️⃣ Build & Test
build:
runs-on: ubuntu-latest
needs: lint
steps:
- uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 10
- name: Node.js
uses: actions/setup-node@v4
with:
node-version: "22"
cache: "pnpm"
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Build
run: pnpm run build
- name: Test
run: pnpm test || true

# Build/Test μ‹€νŒ¨ μ‹œ PR μ½”λ©˜νŠΈ + λ‹«κΈ°
- name: Fail PR if build/test fails
if: ${{ failure() && github.event_name == 'pull_request' }}
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const pr = ${{ github.event.pull_request.number }};
const updated_title = `[CI FAIL] ${{ github.event.pull_request.title }}`;
await github.rest.pulls.createReview({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: pr,
body: 'λΉŒλ“œ λ˜λŠ” ν…ŒμŠ€νŠΈμ— μ‹€νŒ¨ν–ˆμŠ΅λ‹ˆλ‹€.',
event: 'REQUEST_CHANGES'
});
await github.rest.pulls.update({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: pr,
title: updated_title,
state: 'closed'
});

# 2️⃣ Preview 배포 (feat/*, fix/*, refactor/*, style/*, develop PR)
deploy-preview:
if: ${{ !startsWith(github.ref, 'refs/heads/main') }}
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Vercel CLI μ„€μΉ˜
run: npm install -g vercel@latest
- name: Vercel Preview Deploy
id: deploy
run: |
DEPLOY_URL=$(vercel deploy --token=${{ secrets.VERCEL_TOKEN }} --yes)
echo "url=$DEPLOY_URL" >> $GITHUB_OUTPUT
env:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
- name: PR μ½”λ©˜νŠΈμ— Preview URL μž‘μ„±
if: github.event_name == 'pull_request'
uses: actions/github-script@v7
with:
script: |
const deployUrl = '${{ steps.deploy.outputs.url }}';
const comment = `πŸš€ **미리보기 배포 μ™„λ£Œ!**\n\nπŸ“ **배포 URL:** ${deployUrl}\nβœ… **브랜치:** \`${{ github.head_ref }}\`\nβœ… **컀밋:** \`${{ github.sha }}\``;
github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body: comment
});

# 3️⃣ Production 배포 (main push)
deploy-production:
if: github.ref == 'refs/heads/main'
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Vercel CLI μ„€μΉ˜
run: npm install -g vercel@latest
- name: Vercel Production Deploy
id: deploy-prod
run: |
DEPLOY_URL=$(vercel deploy --prod --token=${{ secrets.VERCEL_TOKEN }} --yes)
echo "url=$DEPLOY_URL" >> $GITHUB_OUTPUT
env:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
- name: 운영 배포 μ™„λ£Œ μ•Œλ¦Ό
run: |
echo "πŸŽ‰ 운영 ν™˜κ²½ 배포 μ™„λ£Œ!"
echo "πŸ“ 배포 URL: ${{ steps.deploy-prod.outputs.url }}"
42 changes: 0 additions & 42 deletions src/App.css

This file was deleted.

32 changes: 3 additions & 29 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,35 +1,9 @@
import { useState } from 'react'
import reactLogo from './assets/react.svg'
import viteLogo from '/vite.svg'
import './App.css'

function App() {
const [count, setCount] = useState(0)

return (
<>
<div>
<a href="https://vite.dev" target="_blank">
<img src={viteLogo} className="logo" alt="Vite logo" />
</a>
<a href="https://react.dev" target="_blank">
<img src={reactLogo} className="logo react" alt="React logo" />
</a>
</div>
<h1>Vite + React</h1>
<div className="card">
<button onClick={() => setCount((count) => count + 1)}>
count is {count}
</button>
<p>
Edit <code>src/App.tsx</code> and save to test HMR
</p>
</div>
<p className="read-the-docs">
Click on the Vite and React logos to learn more
</p>
<div>ν…ŒμŠ€νŠΈ 쀑</div>
</>
)
);
}

export default App
export default App;