Merge pull request #106 from 2025-All4Land-RideOn/feature/#84-bookmar… #55
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Deploy to Vercel (RideOn FE) | |
| on: | |
| push: | |
| branches: | |
| - develop | |
| jobs: | |
| deploy: | |
| name: Build and Deploy to Vercel | |
| runs-on: ubuntu-latest | |
| steps: | |
| # 1. 현재 저장소 체크아웃 | |
| - name: Checkout source repository | |
| uses: actions/checkout@v4 | |
| # 2. Node.js 환경 설정 | |
| - name: Setup Node.js environment | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| cache: npm | |
| # 3. Secrets 주입 테스트 | |
| - name: Check injected secrets | |
| run: | | |
| echo "🔍 Checking injected secrets..." | |
| for var in VITE_API_BASE_URL VITE_MAPBOX_TOKEN VITE_VWORLD_API_KEY; do | |
| if [ -z "${!var}" ]; then | |
| echo "❌ $var is missing!" | |
| exit 1 | |
| fi | |
| done | |
| echo "✅ All secrets successfully injected" | |
| env: | |
| VITE_API_BASE_URL: ${{ secrets.VITE_API_BASE_URL }} | |
| VITE_MAPBOX_TOKEN: ${{ secrets.VITE_MAPBOX_TOKEN }} | |
| VITE_VWORLD_API_KEY: ${{ secrets.VITE_VWORLD_API_KEY }} | |
| # 4. 패키지 설치 | |
| - name: Install dependencies | |
| run: | | |
| echo "📦 Installing dependencies..." | |
| npm ci | |
| # 5. 프로젝트 빌드 | |
| - name: Build project | |
| run: | | |
| echo "🏗️ Building project..." | |
| npm run build | |
| env: | |
| NODE_ENV: production | |
| VITE_API_BASE_URL: ${{ secrets.VITE_API_BASE_URL }} | |
| VITE_MAPBOX_TOKEN: ${{ secrets.VITE_MAPBOX_TOKEN }} | |
| VITE_VWORLD_API_KEY: ${{ secrets.VITE_VWORLD_API_KEY }} | |
| # 6. 빌드 결과물 검증 | |
| - name: Verify build output | |
| run: | | |
| if [ ! -d "dist" ]; then | |
| echo "❌ ERROR: dist directory not found" | |
| echo "Current files:" | |
| ls -la | |
| exit 1 | |
| fi | |
| FILE_COUNT=$(find dist -type f | wc -l) | |
| if [ $FILE_COUNT -eq 0 ]; then | |
| echo "❌ ERROR: dist directory is empty" | |
| exit 1 | |
| fi | |
| echo "✅ Build verified: $FILE_COUNT files, $(du -sh dist | cut -f1)" | |
| # 7. 빌드 결과물을 개인 Vercel 배포용 레포로 push | |
| - name: Push build output to Vercel repository | |
| uses: cpina/[email protected] | |
| env: | |
| API_TOKEN_GITHUB: ${{ secrets.GH_PAT }} | |
| with: | |
| source-directory: dist | |
| destination-github-username: MinSang22Kim | |
| destination-repository-name: rideon-fe-vercel | |
| user-name: MinSang22Kim | |
| user-email: ${{ secrets.VERCEL_EMAIL }} | |
| commit-message: "chore: Auto deploy from ${{ github.sha }} [skip ci]" | |
| target-branch: main | |
| # 8. 배포 완료 로그 출력 | |
| - name: Confirm Deployment | |
| if: success() | |
| run: | | |
| echo "✅ dist/ 디렉토리가 rideon-fe-vercel 저장소로 정상적으로 push되었습니다." | |
| echo "🚀 Vercel이 main 브랜치에서 자동으로 배포를 시작합니다." | |
| # 9. 배포 실패 시 디버깅 정보 | |
| - name: Debug on failure | |
| if: failure() | |
| run: | | |
| echo "❌ Deployment failed" | |
| echo "Check: 1) Secrets configured 2) Build output 3) Target repo exists" |