-
Notifications
You must be signed in to change notification settings - Fork 0
60 lines (51 loc) · 1.68 KB
/
gradle.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
name: Deploy
on:
push:
branches: [ "develop" ]
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
steps:
# 기본 체크아웃
- name: Checkout
uses: actions/checkout@v3
# JDK 11 세팅
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- name: Set Yaml
uses: microsoft/variable-substitution@v1
with:
files: './src/main/resources/application-prod.yml'
env:
eureka.client.service-url.defaultZone: ${{secrets.VM_EUREKA_DEFAULTZONE}}
# Gradlew 실행 허용
- name: Run chmod to make gradlew executable
run: chmod +x ./gradlew
# Gradle build (Test 제외)
- name: Build with Gradle
run: ./gradlew clean build --exclude-task test
# Docker build
- name: Docker build
run: |
docker login -u ${{ secrets.DOCKERHUB_USERNAME }} -p ${{ secrets.DOCKERHUB_PASSWORD }}
docker build -t gateway-service .
docker tag gateway-service geunskoo/gateway-service:${GITHUB_SHA::7}
docker push geunskoo/gateway-service:${GITHUB_SHA::7}
# Deploy
- name: Deploy
uses: appleboy/[email protected]
with:
host: ${{ secrets.VM_INSTANCE_HOST }}
username: ${{ secrets.SSH_USERNAME }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
envs: GITHUB_SHA
script: |
docker-compose -f docker-compose.gateway.yml down
docker pull geunskoo/gateway-service:${GITHUB_SHA::7}
docker tag geunskoo/gateway-service:${GITHUB_SHA::7} gateway-service
docker-compose -f docker-compose.gateway.yml up -d