-
Notifications
You must be signed in to change notification settings - Fork 0
Bug/ #21 #30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug/ #21 #30
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,4 +1,4 @@ | ||||||||||||||||
| name: Deploy on PR Merged to develop | ||||||||||||||||
| name: CD on PR Merged to develop | ||||||||||||||||
|
|
||||||||||||||||
| on: | ||||||||||||||||
| pull_request: | ||||||||||||||||
|
|
@@ -7,71 +7,53 @@ on: | |||||||||||||||
|
|
||||||||||||||||
| jobs: | ||||||||||||||||
| build: | ||||||||||||||||
| if: github.event.pull_request.merged == true | ||||||||||||||||
| runs-on: ubuntu-latest | ||||||||||||||||
|
|
||||||||||||||||
| steps: | ||||||||||||||||
| - name: Checkout repository | ||||||||||||||||
| uses: actions/checkout@v3 | ||||||||||||||||
| - name: Checkout Repository | ||||||||||||||||
| uses: actions/checkout@v3 | ||||||||||||||||
|
|
||||||||||||||||
| - name: Set up JDK 17 | ||||||||||||||||
| uses: actions/setup-java@v3 | ||||||||||||||||
| with: | ||||||||||||||||
| java-version: '17' | ||||||||||||||||
| distribution: 'temurin' | ||||||||||||||||
|
|
||||||||||||||||
| - name: Cache Gradle packages | ||||||||||||||||
| uses: actions/cache@v3 | ||||||||||||||||
| with: | ||||||||||||||||
| path: | | ||||||||||||||||
| ~/.gradle/caches | ||||||||||||||||
| ~/.gradle/wrapper | ||||||||||||||||
| key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | ||||||||||||||||
| restore-keys: | | ||||||||||||||||
| ${{ runner.os }}-gradle | ||||||||||||||||
|
|
||||||||||||||||
| - name: Grant permission to gradlew | ||||||||||||||||
| run: chmod +x gradlew | ||||||||||||||||
| - name: Set up JDK 17 | ||||||||||||||||
| uses: actions/setup-java@v3 | ||||||||||||||||
| with: | ||||||||||||||||
| java-version: '17' | ||||||||||||||||
| distribution: 'temurin' | ||||||||||||||||
|
|
||||||||||||||||
fixgramwork marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||
| - name: Build with Gradle | ||||||||||||||||
| run: ./gradlew build | ||||||||||||||||
| - name: Grant permission to gradlew | ||||||||||||||||
| run: chmod +x gradlew | ||||||||||||||||
|
|
||||||||||||||||
| - name: Run tests | ||||||||||||||||
| run: ./gradlew test | ||||||||||||||||
| - name: Build with Gradle | ||||||||||||||||
| run: ./gradlew build | ||||||||||||||||
|
|
||||||||||||||||
| - name: Upload coverage to Codecov | ||||||||||||||||
| uses: codecov/codecov-action@v3 | ||||||||||||||||
| with: | ||||||||||||||||
| token: ${{ secrets.CODECOV_TOKEN }} | ||||||||||||||||
| - name: Upload JAR as artifact | ||||||||||||||||
| uses: actions/upload-artifact@v3 | ||||||||||||||||
| with: | ||||||||||||||||
| name: app-jar | ||||||||||||||||
| path: build/libs/*.jar | ||||||||||||||||
|
|
||||||||||||||||
| deploy-on-merge: | ||||||||||||||||
| if: github.event.pull_request.merged == true # ✔ merge된 PR일 때만 실행 | ||||||||||||||||
| deploy: | ||||||||||||||||
| needs: build | ||||||||||||||||
| runs-on: ubuntu-latest | ||||||||||||||||
|
|
||||||||||||||||
| steps: | ||||||||||||||||
| - name: Checkout source code | ||||||||||||||||
| uses: actions/checkout@v4 | ||||||||||||||||
|
|
||||||||||||||||
| - name: Set up JDK 17 | ||||||||||||||||
| uses: actions/setup-java@v4 | ||||||||||||||||
| - name: Download JAR artifact | ||||||||||||||||
| uses: actions/download-artifact@v3 | ||||||||||||||||
| with: | ||||||||||||||||
| distribution: 'temurin' | ||||||||||||||||
| java-version: 17 | ||||||||||||||||
|
|
||||||||||||||||
| - name: Build with Gradle | ||||||||||||||||
| run: ./gradlew clean build -x test | ||||||||||||||||
| name: app-jar | ||||||||||||||||
|
|
||||||||||||||||
| - name: Set up SSH | ||||||||||||||||
| - name: Set up SSH Agent | ||||||||||||||||
| uses: webfactory/ssh-agent@v0.9.0 | ||||||||||||||||
| with: | ||||||||||||||||
| ssh-private-key: ${{ secrets.EC2_SSH_KEY }} | ||||||||||||||||
|
|
||||||||||||||||
| - name: Copy JAR to EC2 | ||||||||||||||||
| run: | | ||||||||||||||||
| scp -i ${{secrets.EC2_SSH_KEY}} -o StrictHostKeyChecking=no build/libs/*.jar ${{ secrets.EC2_USER }}@${{ secrets.EC2_HOST }}:/home/${{ secrets.EC2_USER }}/app/app.jar | ||||||||||||||||
| scp -o StrictHostKeyChecking=no app-jar/*.jar ${{ secrets.EC2_USER }}@${{ secrets.EC2_HOST }}:/home/ubuntu/app/app.jar | ||||||||||||||||
|
|
||||||||||||||||
|
Comment on lines
50
to
53
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion 원격 경로가 사용자 고정값에 의존합니다.
- scp -o StrictHostKeyChecking=no app-jar/*.jar ${{ secrets.EC2_USER }}@${{ secrets.EC2_HOST }}:/home/ubuntu/app/app.jar
+ scp -o StrictHostKeyChecking=no app-jar/*.jar ${{ secrets.EC2_USER }}@${{ secrets.EC2_HOST }}:~/app/app.jar📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||
| - name: Restart App with Docker Compose | ||||||||||||||||
| run: | | ||||||||||||||||
| ssh -i ${{secrets.EC2_SSH_KEY}} -o StrictHostKeyChecking=no ${{ secrets.EC2_USER }}@${{ secrets.EC2_HOST }} << 'EOF' | ||||||||||||||||
| cd /home/${{ secrets.EC2_USER }}/app | ||||||||||||||||
| ssh -o StrictHostKeyChecking=no ${{ secrets.EC2_USER }}@${{ secrets.EC2_HOST }} << 'EOF' | ||||||||||||||||
| cd /home/ubuntu/app | ||||||||||||||||
| docker compose up -d --force-recreate | ||||||||||||||||
| EOF | ||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actions/checkout버전을 v4로 올려야 최신 러너에서 동작합니다.actionlint 경고대로 v3 러너는 더 이상 권장되지 않습니다. 이미 v4가 GA 상태이므로 바로 교체하는 편이 좋습니다.
📝 Committable suggestion
🧰 Tools
🪛 actionlint (1.7.7)
15-15: the runner of "actions/checkout@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue
(action)
🤖 Prompt for AI Agents