Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
LUCETE012 committed Oct 4, 2024
2 parents 1531ce1 + f679176 commit 4f4151a
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 0 deletions.
53 changes: 53 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: CI/CD Pipeline for Spring Boot with Gradle

on:
push:
branches:
- main # 또는 배포하려는 브랜치

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout Code
uses: actions/checkout@v3

- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'

- name: Grant execute permission for gradlew
run: chmod +x ./gradlew

- name: Build with Gradle
run: ./gradlew build

- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: spring-boot-app
path: build/libs/*.jar # Gradle의 빌드 아웃풋 경로

deploy:
runs-on: ubuntu-latest
needs: build
steps:
- name: Download Artifacts
uses: actions/download-artifact@v3
with:
name: spring-boot-app

- name: Deploy to EC2
uses: appleboy/[email protected]
with:
host: ${{ secrets.EC2_HOST }}
username: ec2-user
key: ${{ secrets.SSH_PRIVATE_KEY }} # SSH 접근을 위한 개인 키
script: |
sudo pkill -f 'java -jar' || true # 기존 Java 프로세스 종료
sudo rm -rf /home/ec2-user/app/* # 이전 빌드 파일 삭제
sudo mv *.jar /home/ec2-user/app/app.jar # 새 파일 이동
sudo nohup java -jar /home/ec2-user/app/app.jar > /home/ec2-user/app/app.log 2>&1 & # 새 애플리케이션 실행
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 새천년건강체조

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

0 comments on commit 4f4151a

Please sign in to comment.