File tree Expand file tree Collapse file tree 3 files changed +99
-0
lines changed
Expand file tree Collapse file tree 3 files changed +99
-0
lines changed Original file line number Diff line number Diff line change 1+ ## ✨ 구현한 기능
2+ -
3+ ## 📢 논의하고 싶은 내용
4+ -
5+ ## 🎸 기타
6+ -
Original file line number Diff line number Diff line change 1+ name : CI Workflow
2+
3+ on :
4+ push :
5+ branches :
6+ - main # main 브랜치
7+ - develop # develop 브랜치
8+ - feature/* # 모든 feature/* 브랜치
9+ pull_request :
10+ branches :
11+ - main # main 브랜치로의 PR
12+ - develop # develop 브랜치로의 PR
13+ - feature/* # feature/* 브랜치로의 PR
14+
15+ jobs :
16+ build-and-test :
17+ runs-on : ubuntu-latest
18+
19+ steps :
20+ # 1. 리포지토리 체크아웃
21+ - name : Check out repository
22+ uses : actions/checkout@v3
23+
24+ # 2. JDK 23 설정
25+ - name : Set up JDK 23
26+ uses : actions/setup-java@v3
27+ with :
28+ distribution : temurin
29+ java-version : ' 23'
30+
31+ # 3. Gradle 캐시 적용
32+ - name : Cache Gradle packages
33+ uses : actions/cache@v3
34+ with :
35+ path : |
36+ ~/.gradle/caches
37+ ~/.gradle/wrapper
38+ key : ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
39+ restore-keys : |
40+ ${{ runner.os }}-gradle-
41+
42+ # 4. dev.sh 실행 (환경 변수 로드 및 빌드 준비)
43+ - name : Run dev.sh
44+ run : |
45+ chmod +x ./dev.sh # dev.sh에 실행 권한 부여
46+ ./dev.sh # dev.sh 실행
47+
48+ # 5. Gradle 빌드 및 테스트 실행
49+ - name : Build and Test (Gradle)
50+ run : |
51+ ./gradlew clean build -x test
52+ ./gradlew test
Original file line number Diff line number Diff line change 1+ name : CI/CD Workflow for EC2 Deployment
2+
3+ on :
4+ push :
5+ branches :
6+ - main # main 브랜치에 푸시될 때 실행
7+
8+ jobs :
9+ deploy :
10+ runs-on : ubuntu-latest
11+
12+ steps :
13+ # 1.코드 체크아웃
14+ - name : Checkout code
15+ uses : actions/checkout@v3
16+
17+ # 2. EC2로 코드 복사 및 스크립트 실행
18+ - name : Deploy to EC2
19+ 20+ with :
21+ host : ${{ secrets.EC2_HOST }}
22+ username : ${{ secrets.EC2_USER }}
23+ key : ${{ secrets.EC2_SSH_KEY }}
24+ script : |
25+ echo "[GitHub Actions] Starting deployment on EC2"
26+
27+ # 레포지토리 클론 또는 Pull
28+ if [ -d "/home/ubuntu/ring-us-server" ]; then
29+ echo "[GitHub Actions] Pulling latest code"
30+ cd /home/ubuntu/ring-us-server && git pull origin main
31+ else
32+ echo "[GitHub Actions] Cloning repository"
33+ git clone [email protected] :Ring-Us/ring-us-server.git /home/ubuntu/ring-us-server 34+ cd /home/ubuntu/ring-us-server
35+ fi
36+
37+ # 권한 설정 (dev.sh 실행 가능하도록, 추후에 deploy.sh와 분리)
38+ chmod +x dev.sh
39+
40+ # 스크립트 실행 (환경 변수 로드, 빌드, 배포 포함)
41+ ./dev.sh
You can’t perform that action at this time.
0 commit comments