Skip to content
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

[BE] chore: be CD 초기 구축 #106

Merged
merged 27 commits into from
Jul 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
e028e30
chore: be CD 초기 구축
ehtjsv2 Jul 18, 2024
a730b1f
chore: cd 테스트
ehtjsv2 Jul 18, 2024
8894c80
chore: 모든 폴더에 대해 트리거 적용
ehtjsv2 Jul 18, 2024
617362a
chore: working directory 설정
ehtjsv2 Jul 18, 2024
ae859c2
chore: artifact 저장
ehtjsv2 Jul 18, 2024
113a23c
chore: 의ㅣ없는 pr
ehtjsv2 Jul 18, 2024
405ae53
chore: pr workflow에 deploy 합쳐보기
ehtjsv2 Jul 18, 2024
6527f30
chore: ci 끄기
ehtjsv2 Jul 18, 2024
53eb7b1
chore: ci 끄기2
ehtjsv2 Jul 18, 2024
330756b
chore: job 직렬처리
ehtjsv2 Jul 18, 2024
d32e963
chore: 경로변경
ehtjsv2 Jul 18, 2024
ce1b2d5
chore: ls 적용
ehtjsv2 Jul 18, 2024
148fb37
chore: 이동 후 보기
ehtjsv2 Jul 18, 2024
20a133a
chore: 이동 보기 합침
ehtjsv2 Jul 18, 2024
6533e5d
chore: working directory 분리
ehtjsv2 Jul 18, 2024
70db0c6
chore: 파일 에러 제거
ehtjsv2 Jul 18, 2024
7ead862
chore: gradlew 권한 설정도 디렉토리설정
ehtjsv2 Jul 18, 2024
7ca8007
chore: 성공
ehtjsv2 Jul 18, 2024
ad9f0fe
chore: 성공2
ehtjsv2 Jul 18, 2024
96298e0
chore: 성공3
ehtjsv2 Jul 18, 2024
371c40e
Update backend-cd-workflow.yml
ehtjsv2 Jul 18, 2024
fc694e7
Update backend-cd-workflow.yml
ehtjsv2 Jul 18, 2024
b47d81c
Update backend-cd-workflow.yml
ehtjsv2 Jul 18, 2024
9be5003
chore: depth 얕게 수정
ehtjsv2 Jul 18, 2024
1a508b0
chore: CD는 backend 변경사항의 push만 트리거 되도록 수정
ehtjsv2 Jul 18, 2024
67ac9df
chore: CI는 pr만 트리거 되도록 수정
ehtjsv2 Jul 18, 2024
38e6609
chore: CI_백엔드 패키지의 변경사항만을 트리거 되도록 수정
ehtjsv2 Jul 18, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 78 additions & 0 deletions .github/workflows/backend-cd-workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: deploy

on:
push:
branches: ['develop']
paths:
- 'backend/**'

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout Repository
uses: actions/checkout@v4

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

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
with:
gradle-version: 8.1.1

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

- name: Build project using Gradle
working-directory: ./backend
run: ./gradlew build

- name: Upload build artifact
uses: actions/upload-artifact@v3
with:
working-directory: ./backend
name: friendogly-be-develop-jar
path: ./**/friendogly-0.0.1-SNAPSHOT.jar

deploy:
needs: build
runs-on: self-hosted
steps:
- name: change permission
run: |
sudo chown -R ubuntu:ubuntu /home/ubuntu/actions-runner/_work/2024-friendogly
- name: Download build artifact
uses: actions/download-artifact@v3
with:
name: friendogly-be-develop-jar
path: ./backend/build/libs

- name: Check if room-esc server is running on port 8080
id: check-server-on-port
run: |
echo "Checking if port 8080 is in use..."
PID=$(lsof -t -i:8080 || true)
if [ -n "$PID" ]; then
echo "server_running=true" >> $GITHUB_ENV
echo "PID=$PID" >> $GITHUB_ENV
else
echo "server_running=false" >> $GITHUB_ENV
fi
- name: Stop server if running
if: env.server_running == 'true'
run: |
echo "Stopping server running on port 8080..."
kill -9 $PID
echo "Preivous running Server stopped."
- name: Start server
run: |
cd backend/build/libs
cd backend/build/libs
sudo nohup java -jar friendogly-0.0.1-SNAPSHOT.jar &
echo "Lastest Backend API Server started."
9 changes: 5 additions & 4 deletions .github/workflows/backend-pull-request-ci.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
name: backend-ci

on:
push:
branches: [ "develop" ]
paths:
- 'backend/**'
pull_request:
branches: [ "develop" ]
paths:
Expand Down Expand Up @@ -65,3 +61,8 @@ jobs:
with:
report_paths: './backend/build/test-results/test/TEST-*.xml'
token: ${{ github.token }}

- name: Start server
run: |
sudo nohup java -jar build/libs/friendogly-0.0.1-SNAPSHOT.jar &
echo "Lastest Backend API Server started."