-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #251 from capstone-kw-jjiggle/main
[deploy] release 브랜치로 머지 후 바로 머지 진행하겠습니다!
- Loading branch information
Showing
13 changed files
with
98 additions
and
530 deletions.
There are no files selected for viewing
This file contains 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,68 @@ | ||
name: develop branch bluegreen deployment | ||
|
||
on: | ||
push: | ||
branches: | ||
- release* # Trigger on any branch that starts with "release" | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
# 1. JDK 17 설정 | ||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: '17' | ||
distribution: 'temurin' | ||
|
||
# 2. Gradle 설정 | ||
- name: Setup Gradle | ||
uses: gradle/actions/setup-gradle@417ae3ccd767c252f5661f1ace9f835f9654f2b5 # v3.1.0 | ||
|
||
# 3. Jar 파일 빌드 (테스트 제외) | ||
- name: Build with Gradle Wrapper | ||
run: ./gradlew -x test bootJar | ||
|
||
# 4. Docker Buildx 설정 | ||
- name: Set up Docker Build | ||
uses: docker/setup-buildx-action@v1 | ||
|
||
# 5. Docker 로그인 | ||
- name: Login to Docker Hub | ||
uses: docker/login-action@v1 | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_TOKEN }} | ||
|
||
# 6. Docker 이미지 빌드 및 푸시 | ||
- name: Build and push Docker image | ||
run: | | ||
docker build -t ${{ secrets.DOCKER_USERNAME }}/rankitrun-be:latest . | ||
docker push ${{ secrets.DOCKER_USERNAME }}/rankitrun-be:latest | ||
deploy: | ||
runs-on: ubuntu-latest | ||
needs: build # build 작업이 완료되어야 실행 | ||
permissions: | ||
contents: read | ||
|
||
steps: | ||
# 1. EC2 SSH 접속을 위한 키 등록 | ||
- name: Set up SSH key | ||
uses: webfactory/[email protected] | ||
with: | ||
ssh-private-key: ${{ secrets.API_RANKIT_PEM }} | ||
|
||
# 2. EC2에 blue green 무중단 배포를 위한 스크립트 실행 | ||
- name: Run deploy.sh | ||
run: | | ||
ssh -o StrictHostKeyChecking=no ec2-user@${{ secrets.EC2_HOST }} << 'EOF' | ||
chmod +x deploy.sh # 만약 실행 권한이 없다면 추가 | ||
./deploy.sh # 스크립트 실행 | ||
EOF |
This file was deleted.
Oops, something went wrong.
This file contains 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 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 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 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.