-
Notifications
You must be signed in to change notification settings - Fork 0
feat: prod 배포 환경 구축 (#39) #41
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
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| name: CD Prod | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - main | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| concurrency: | ||
| group: deploy-prod | ||
| cancel-in-progress: false | ||
|
|
||
| jobs: | ||
| deploy-prod: | ||
| name: Deploy to Prod EC2 | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| persist-credentials: false | ||
|
|
||
| - name: Set up Java 21 | ||
| uses: actions/setup-java@v4 | ||
| with: | ||
| distribution: temurin | ||
| java-version: "21" | ||
| cache: gradle | ||
|
|
||
| - name: Make Gradle Wrapper executable | ||
| run: chmod +x ./gradlew | ||
|
|
||
| - name: Test and build Spring Boot jar | ||
| run: ./gradlew clean test bootJar --no-daemon | ||
|
|
||
| - name: Copy jar to EC2 | ||
|
young0206 marked this conversation as resolved.
|
||
| uses: appleboy/scp-action@v1 | ||
| with: | ||
| host: ${{ secrets.PROD_EC2_HOST }} | ||
| username: ${{ secrets.PROD_EC2_USERNAME }} | ||
| key: ${{ secrets.PROD_EC2_SSH_KEY }} | ||
| fingerprint: ${{ secrets.PROD_EC2_HOST_FINGERPRINT }} | ||
| source: build/libs/slatto.jar | ||
| target: /home/ubuntu/SLAT-TO-BE/build/libs/ | ||
|
|
||
| - name: Deploy | ||
| uses: appleboy/ssh-action@v1 | ||
| with: | ||
| host: ${{ secrets.PROD_EC2_HOST }} | ||
| username: ${{ secrets.PROD_EC2_USERNAME }} | ||
| key: ${{ secrets.PROD_EC2_SSH_KEY }} | ||
| fingerprint: ${{ secrets.PROD_EC2_HOST_FINGERPRINT }} | ||
| script: | | ||
| chmod +x /home/ubuntu/deploy/deploy.sh | ||
| /home/ubuntu/deploy/deploy.sh | ||
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
🔒 Security & Privacy | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
Repository: SLAT-TO/SLAT-TO-BE
Length of output: 2071
🏁 Script executed:
Repository: SLAT-TO/SLAT-TO-BE
Length of output: 2071
🏁 Script executed:
Repository: SLAT-TO/SLAT-TO-BE
Length of output: 2071
프로덕션 배포 액션을 커밋 SHA로 고정하세요.
.github/workflows/cd-prod.yml의22, 27, 40, 50행에서actions/checkout@v4,actions/setup-java@v4,appleboy/scp-action@v1,appleboy/ssh-action@v1가 변경 가능한 태그를 사용합니다. 배포 경로에서는 태그 이동만으로 동작이 바뀔 수 있으니 전체 커밋 SHA로 바꾸고 버전 주석은 유지하세요.🤖 Prompt for AI Agents