- eslint ^10 → ^9 다운그레이드 (react-hooks 플러그인 호환) - .npmrc 제거, Dockerfile legacy-peer-deps 플래그 제거 - Dockerfile node:lts → node:22-alpine 버전 고정, ARG 오타 수정 - .dockerignore 추가 (.env, node_modules, .git 등 제외) - .env 삭제, .env.development 추가 (로컬 기본값 git 관리) - vite.config.js dev proxy 추가 (/api → localhost:8080) - index.html favicon, OG 태그, Pretendard 폰트 로드 추가 - nginx.conf /images/ 캐시 전략 추가, 주석 정리 - eslint.config.js ecmaVersion 중복 선언 정리 - deploy.yml --legacy-peer-deps, --no-cache 제거, 배포 커맨드 가독성 개선 - .github/workflows/ci.yml 삭제 (Gitea 사용으로 불필요) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
62 lines
1.9 KiB
YAML
62 lines
1.9 KiB
YAML
name: Client CI/CD
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
|
|
jobs:
|
|
test:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: 코드 체크아웃
|
|
run: |
|
|
git config --global --add safe.directory /workspace/A301/a301_client
|
|
git init
|
|
git remote add origin $GITHUB_SERVER_URL/$GITHUB_REPOSITORY.git
|
|
git fetch --depth=1 origin $GITHUB_SHA
|
|
git checkout $GITHUB_SHA
|
|
|
|
- name: Node.js 설정
|
|
run: |
|
|
if ! command -v node &>/dev/null || [ "$(node -v | cut -d. -f1 | tr -d v)" -lt 22 ]; then
|
|
curl -fsSL https://deb.nodesource.com/setup_22.x | bash -
|
|
apt-get install -y nodejs
|
|
fi
|
|
node -v && npm -v
|
|
|
|
- name: 의존성 설치
|
|
run: npm ci
|
|
|
|
- name: 린트 검사
|
|
run: npm run lint
|
|
|
|
- name: 테스트 실행
|
|
run: npm test
|
|
|
|
- name: 프로덕션 빌드 검증
|
|
run: npm run build
|
|
|
|
deploy:
|
|
runs-on: ubuntu-latest
|
|
needs: test
|
|
steps:
|
|
- name: 서버에 배포
|
|
run: |
|
|
mkdir -p ~/.ssh
|
|
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/deploy_key
|
|
chmod 600 ~/.ssh/deploy_key
|
|
ssh -o StrictHostKeyChecking=no -i ~/.ssh/deploy_key \
|
|
${{ secrets.SERVER_USER }}@${{ secrets.SERVER_HOST }} \
|
|
'set -e &&
|
|
export PATH=$PATH:/usr/local/bin:/opt/homebrew/bin:$HOME/.docker/bin &&
|
|
cd /tmp &&
|
|
rm -rf a301-client &&
|
|
git clone --quiet https://tolelom:${{ secrets.GIT_TOKEN }}@git.tolelom.xyz/A301/a301_client.git a301-client &&
|
|
cd a301-client &&
|
|
docker build --build-arg VITE_API_BASE_URL=${{ secrets.VITE_API_BASE_URL }} -t a301-client:latest . &&
|
|
cd ~/server &&
|
|
docker compose up -d --force-recreate a301-client &&
|
|
rm -rf /tmp/a301-client'
|
|
rm -f ~/.ssh/deploy_key
|