-
Notifications
You must be signed in to change notification settings - Fork 3
87 lines (74 loc) ยท 2.27 KB
/
dev-deploy.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
86
87
name: Publish Reviewzip
on:
release:
types: [published]
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build-and-push-image:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
# JDK ์ค์น
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
#์๋ธ ๋ชจ๋ ์ ๊ทผ
- name: Checkout repo
uses: actions/checkout@v3
with:
token: ${{ secrets.PERSONAL_TOKEN }}
submodules: true
# ์๋ธ ๋ชจ๋ ๋ณ๊ฒฝ ์ ์์ผ๋ฉด update
- name: Git Submodule Update
run: |
git submodule update --remote --recursive
- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ${{env.REGISTRY}}
username: ${{github.actor}}
password: ${{secrets.PERSONAL_TOKEN}}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: ${{env.REGISTRY}}/${{env.IMAGE_NAME}}
# gradlew ๊ถํ ๋ณ๊ฒฝ
- name: Grant execute permission for gradlew
run: chmod +x gradlew
# ๋น๋(test๋ ์ ์ธ)
- name: Build with Gradle
uses: gradle/gradle-build-action@v2
with:
arguments: clean build -x test
- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
code-deploy:
needs: build-and-push-image
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Access to server and Run container
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.SERVER_IP }}
username: ${{ secrets.SERVER_USER }}
password: ${{ secrets.SSH_PASSWORD }}
script: |
cd reviewzip-server
docker-compose down
docker-compose rm
docker rmi ${{ secrets.IMAGE_NAME }}
docker pull ${{ secrets.IMAGE_NAME }}
docker-compose up -d