-
Notifications
You must be signed in to change notification settings - Fork 1
64 lines (51 loc) · 1.74 KB
/
mineme-dev.yaml
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
name: MINEME-DEV CI/CD
on:
push:
branches: ['develop']
pull_request:
branches: ['develop']
jobs:
build:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 11
- name: Make Application.yml
run: |
## create application.yml
cd ./src/main/resources
# GitHub-Actions 에서 설정한 값을 application.yml 파일에 쓰기
echo "${{ secrets.APPLICATION_DEV }}" > ./application.yml
shell: bash
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
run: ./gradlew bootJar
- name: Docker login
run: docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }}
- name: Docker build
run: |
DATE=$(date "+%y.%m.%d")
docker build -t ${{ secrets.DOCKER_REPO }}/mineme-api:$DATE .
- name: Docker push
run: |
DATE=$(date "+%y.%m.%d")
docker push ${{ secrets.DOCKER_REPO }}/mineme-api:$DATE
- name: Deploy
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.REMOTE_IP }}
username: ${{ secrets.REMOTE_SSH_ID }}
key: ${{ secrets.REMOTE_SSH_KEY }}
port: ${{ secrets.REMOTE_SSH_PORT }}
script: |
DATE=$(date "+%y.%m.%d")
docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }}
docker stop MINEME_DEV
docker rm -f MINEME_DEV
docker pull ${{ secrets.DOCKER_REPO }}/mineme-api:$DATE
./server_start.sh
docker image prune -f