요약 및 리뷰 모델 수정 #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: Deploy to EC2 | |
| on: | |
| push: | |
| branches: [ master ] | |
| jobs: | |
| build: | |
| runs-on: self-hosted | |
| env: | |
| WEBHOOK_SECRET: ${{ secrets.WEBHOOK_SECRET }} | |
| GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }} | |
| API_TOKEN_GITHUB: ${{ secrets.API_TOKEN_GITHUB }} | |
| APP_ID: ${{ secrets.APP_ID }} | |
| APP_PEM: ${{ secrets.APP_PEM }} | |
| steps: | |
| - name: Clean GitHub Actions cache only | |
| run: | | |
| echo "🧹 Cleaning GitHub Actions cache at ~/Library/Caches/actions..." | |
| du -sh ~/Library/Caches/actions || true | |
| rm -rf ~/Library/Caches/actions || true | |
| echo "✅ Cleanup completed." | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up JDK | |
| uses: actions/setup-java@v3 | |
| with: | |
| distribution: 'temurin' | |
| java-version: '21' | |
| - name: Grant execute permission for Gradle wrapper | |
| run: chmod +x ./gradlew | |
| - name: Build with Gradle | |
| run: ./gradlew clean build | |
| - name: Upload JAR artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: app-jar | |
| path: build/libs/*.jar | |
| dockerize: | |
| runs-on: self-hosted | |
| needs: build | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Download JAR artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: app-jar | |
| - name: Move JAR to expected path | |
| run: | | |
| mkdir -p build/libs | |
| mv *.jar build/libs/ | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Log in to Docker Hub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKER_USERNAME }} | |
| password: ${{ secrets.DOCKER_PASSWORD }} | |
| - name: Build and push Docker image | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| push: true | |
| tags: ${{ secrets.DOCKER_USERNAME }}/code-review:latest | |
| platforms: linux/amd64,linux/arm64 | |
| deploy: | |
| runs-on: self-hosted | |
| needs: dockerize | |
| env: | |
| WEBHOOK_SECRET: ${{ secrets.WEBHOOK_SECRET }} | |
| GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }} | |
| API_TOKEN_GITHUB: ${{ secrets.API_TOKEN_GITHUB }} | |
| APP_ID: ${{ secrets.APP_ID }} | |
| APP_PEM: ${{ secrets.APP_PEM }} | |
| steps: | |
| - name: Setup SSH | |
| uses: webfactory/ssh-agent@v0.7.0 | |
| with: | |
| ssh-private-key: ${{ secrets.EC2_SSH_KEY }} | |
| - name: Deploy to EC2 | |
| run: | | |
| ssh -o StrictHostKeyChecking=no ${{ secrets.EC2_USER }}@${{ secrets.EC2_HOST }} "\ | |
| export WEBHOOK_SECRET='${{ secrets.WEBHOOK_SECRET }}' && \ | |
| export GEMINI_API_KEY='${{ secrets.GEMINI_API_KEY }}' && \ | |
| export API_TOKEN_GITHUB='${{ secrets.API_TOKEN_GITHUB }}' && \ | |
| export APP_ID='${{ secrets.APP_ID }}' && \ | |
| export APP_INSTALLATION_ID='${{ secrets.APP_INSTALLATION_ID }}' && \ | |
| export APP_PEM='${{ secrets.APP_PEM }}' && \ | |
| ./code-review-deploy.sh" |