Skip to content

Commit ac0c4a0

Browse files
committed
update ci
1 parent 81be28f commit ac0c4a0

File tree

3 files changed

+74
-175
lines changed

3 files changed

+74
-175
lines changed

.github/workflows/ci.yml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# .github/workflows/backend-ci.yml
2+
name: Backend CI
3+
4+
on:
5+
push:
6+
branches: [ develop, main ]
7+
8+
9+
env:
10+
NCP_REGISTRY: blockcloud.kr.ncr.ntruss.com
11+
NCR_REPO: blockcloud
12+
APP_NAME: backend-app
13+
IMAGE_TAG: ${{ github.sha }}
14+
15+
jobs:
16+
build-and-test:
17+
runs-on: ubuntu-latest
18+
19+
steps:
20+
# 코드 체크아웃
21+
- name: Checkout repository
22+
uses: actions/checkout@v4
23+
24+
# JDK 21 설정
25+
- name: Set up JDK 21
26+
uses: actions/setup-java@v4
27+
with:
28+
distribution: 'temurin'
29+
java-version: '21'
30+
31+
# Gradle 캐시 설정
32+
- name: Cache Gradle
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: ${{ runner.os }}-gradle-
40+
41+
# application.yml 생성
42+
- name: Create application.yml files
43+
run: |
44+
mkdir -p src/main/resources
45+
echo "${{ secrets.APPLICATION_YML }}" > ./src/main/resources/application.yml
46+
echo "${{ secrets.APPLICATION_YML_DEV }}" > ./src/main/resources/application-dev.yml
47+
echo "${{ secrets.APPLICATION_YML_PROD }}" > ./src/main/resources/application-prod.yml
48+
echo "${{ secrets.APPLICATION_YML_SECRET }}" > ./src/main/resources/application-secret.yml
49+
50+
# gradlew 실행 권한 부여
51+
- name: Grant execute permission for gradlew
52+
run: chmod +x ./gradlew
53+
54+
# Gradle 빌드 실행
55+
- name: Build with Gradle
56+
run: ./gradlew clean build -x test
57+
58+
- name: 2. Docker Buildx 설정
59+
uses: docker/setup-buildx-action@v3
60+
61+
- name: 3. NCR (Container Registry) 로그인
62+
uses: docker/login-action@v3
63+
with:
64+
registry: ${{ env.NCP_REGISTRY }}
65+
username: ${{ secrets.NCP_ACCESS_KEY }}
66+
password: ${{ secrets.NCP_SECRET_KEY }}
67+
68+
- name: 4. Docker 이미지 빌드 및 푸시
69+
uses: docker/build-push-action@v5
70+
with:
71+
context: .
72+
file: Dockerfile
73+
push: true
74+
tags: ${{ env.NCP_REGISTRY }}/${{ env.NCR_REPO }}/${{ env.APP_NAME }}:${{ env.IMAGE_TAG }}

.github/workflows/deploy.yml

Lines changed: 0 additions & 119 deletions
This file was deleted.

.github/workflows/test.yml

Lines changed: 0 additions & 56 deletions
This file was deleted.

0 commit comments

Comments
 (0)