.gitignore 파일에서 .env 파일을 제외하는 설정을 제거하여 Git 관리에서 환경변수 파일을 포함하도록 변경했습니다. #28
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: 🚀 Build and Deploy to GitHub Pages | |
| on: | |
| # main 브랜치에 push될 때 실행 | |
| push: | |
| branches: [ main, master ] | |
| # 수동으로도 실행 가능 | |
| workflow_dispatch: | |
| # GitHub Pages 배포를 위한 권한 설정 | |
| permissions: | |
| contents: write # gh-pages 브랜치에 쓰기 위해 필요 | |
| pages: write | |
| id-token: write | |
| # 동시 배포 방지 (큐에 있는 실행은 취소) | |
| concurrency: | |
| group: "pages" | |
| cancel-in-progress: false | |
| jobs: | |
| # 빌드 및 배포 작업 | |
| build-and-deploy: | |
| name: 🔨 Build and Deploy | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: 📦 Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| # gh-pages 브랜치 생성을 위해 전체 히스토리 필요 | |
| fetch-depth: 0 | |
| - name: 🟢 Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '18' | |
| cache: 'npm' | |
| - name: 📥 Install dependencies | |
| run: npm ci | |
| - name: 🔍 Type check | |
| run: npm run type-check | |
| - name: 🧹 Lint code (optional) | |
| run: npm run lint || echo "Linting skipped" | |
| continue-on-error: true | |
| - name: 🏗️ Build project | |
| run: npm run build | |
| env: | |
| # GitHub Secrets에서 가져오는 환경변수들 | |
| VITE_GITHUB_APP_ID: ${{ secrets.APP_ID }} | |
| VITE_GITHUB_APP_NAME: ${{ secrets.APP_NAME || 'github-issues-chat' }} | |
| VITE_GITHUB_ISSUE_NUMBER: ${{ vars.ISSUE_NUMBER || '1' }} | |
| VITE_GITHUB_REPO_OWNER: ${{ github.repository_owner }} | |
| VITE_GITHUB_REPO_NAME: ${{ github.event.repository.name }} | |
| # 프로덕션 빌드 설정 | |
| NODE_ENV: production | |
| - name: 🚀 Deploy to gh-pages branch | |
| uses: peaceiris/actions-gh-pages@v3 | |
| with: | |
| # GitHub Token 사용 (자동으로 제공됨) | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| # 배포할 디렉터리 | |
| publish_dir: ./dist | |
| # gh-pages 브랜치로 배포 | |
| publish_branch: gh-pages | |
| # 커밋 메시지 설정 | |
| commit_message: 🚀 Deploy from ${{ github.sha }} | |
| # 사용자 정보 설정 | |
| user_name: 'github-actions[bot]' | |
| user_email: 'github-actions[bot]@users.noreply.github.com' | |
| # .nojekyll 파일 추가 (SPA를 위해 필요) | |
| enable_jekyll: false | |
| - name: 🎉 Deployment Success | |
| run: | | |
| echo "✅ 배포가 성공적으로 완료되었습니다!" | |
| echo "🌐 사이트 URL: https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}/" | |
| echo "🔧 Repository: ${{ github.repository }}" | |
| echo "📦 gh-pages 브랜치로 배포되었습니다!" |