-
Notifications
You must be signed in to change notification settings - Fork 1
74 lines (66 loc) · 2.03 KB
/
cd.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
name: Continuous Deployment
on:
push:
branches: [ "develop" ]
workflow_dispatch:
inputs:
logLevel:
description: 'Log level'
required: true
default: 'warning'
type: choice
options:
- info
- warning
- debug
tags:
description: 'Test scenario tags'
required: false
type: boolean
environment:
description: 'Environment to run tests against'
type: environment
required: false
permissions:
contents: read
jobs:
deploy:
runs-on: ubuntu-20.04
steps:
# 1. dev branch 코드 내려 받기
- name: Checkout PR
uses: actions/checkout@v3
with:
ref: ${{ github.event.push.base_ref }}
# 2. 자바 환경 설정
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
# 3. Spring 환경 변수 설정
- name: Set up application.yml
run: |
cd ./src/main/resources
touch ./application.yml
echo "${{ secrets.APPLICATION }}" > ./application.yml
shell: bash
# 4. Docker 이미지 build 및 push
- name: docker build and push
run: |
docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }}
docker build -t minjeongs/oot-was:latest .
docker push minjeongs/oot-was:latest
# 5. SSH ACTION을 통한 Run-Command (Docker 이미지 pull 후 docker-compose를 통한 실행)
- name: deploy
uses: appleboy/[email protected]
with:
host: ${{ secrets.SERVER_HOST }}
port: ${{ secrets.SERVER_SSH_PORT }}
username: ${{ secrets.SERVER_USERNAME }}
password: ${{ secrets.SERVER_PASSWORD }}
script: |
docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }}
docker system prune -a -f
docker pull minjeongs/oot-was:latest
docker-compose up -d