-
Notifications
You must be signed in to change notification settings - Fork 0
85 lines (73 loc) · 2.74 KB
/
dev-CI.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
name: dev-CI
on:
pull_request:
branches: [ "develop" ]
jobs:
dev-ci:
# Using Environment - dev 환경
environment: dev
# Operating system - ubuntu-22.04
runs-on: ubuntu-22.04
permissions:
contents: read
steps:
# Checkout - 가상 머신에 체크아웃
- name: Checkout code
uses: actions/checkout@v3
# JDK setting - JDK 17 설정
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
# gradle caching - 빌드 시간 향상
- name: Gradle Caching
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
# Inject environment variables - 환경 변수를 yml 파일에 주입
- name: Inject environment variables into application-dev.yml
env:
DEV_DB_URL: ${{ secrets.DEV_DB_URL }}
DEV_DB_USERNAME: ${{ secrets.DEV_DB_USERNAME }}
DEV_DB_PASSWORD: ${{ secrets.DEV_DB_PASSWORD }}
DEV_JWT_SECRET: ${{ secrets.DEV_JWT_SECRET }}
DEV_KAKAO_CLIENT_ID: ${{ secrets.DEV_KAKAO_CLIENT_ID }}
DEV_KAKAO_CLIENT_SECRET: ${{ secrets.DEV_KAKAO_CLIENT_SECRET }}
DEV_KAKAO_REDIRECT_URI: ${{ secrets.DEV_KAKAO_REDIRECT_URI }}
run: |
cd ./src/main/resources
envsubst < application-dev.yml > application-dev.tmp.yml && mv application-dev.tmp.yml application-dev.yml
# gradle build - 테스트 없이 gradle 빌드
- name: Build with Gradle
run: |
chmod +x gradlew
./gradlew build -x test
shell: bash
# Set up Docker Buildx - Docker Buildx 설치
- name: Set up Docker Buildx
uses: docker/[email protected]
# Log in to Docker Hub - Docker Hub 로그인
- name: Log in to Docker Hub
uses: docker/[email protected]
with:
username: ${{ secrets.DEV_DOCKER_LOGIN_USERNAME }}
password: ${{ secrets.DEV_DOCKER_LOGIN_ACCESSTOKEN }}
# Build and push Docker image - Docker image 빌드 및 푸시
- name: Build and push Docker image
run: |
docker build -f Dockerfile-dev --platform linux/amd64 -t hoonyworld/beat-dev .
docker push hoonyworld/beat-dev
# Trigger Jenkins job - Jenkins 작업 트리거
- name: Trigger Jenkins job
uses: appleboy/jenkins-action@master
with:
url: ${{ secrets.DEV_WEBHOOK_URL }}
user: "beat"
token: ${{ secrets.DEV_JENKINS_API_TOKEN }}
job: "beat-project"