-
Notifications
You must be signed in to change notification settings - Fork 0
49 lines (41 loc) ยท 1.51 KB
/
dev-api-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
name: Deploy DEV to NCP
on:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
environment: dev
name: "์ด๋ฏธ์ง ๋น๋ํ๊ธฐ"
steps:
- name: "GitHub ์์ ๋ ํฌ ๋ฐ์์ค๊ธฐ"
uses: actions/checkout@v3
- name: "JDK17 ์ค๋นํ๊ธฐ"
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- name: "Gradle ์ค๋นํ๊ธฐ"
run: chmod +x gradlew
- name: "Gradle ๋น๋"
run: ./gradlew -p moring-api clean build -x test
- name: "๋์ปค ๋น๋ ๋ฐ ํธ์"
run: |
docker login ${{ secrets.DOCKER_REPO }} -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }}
docker build -t ${{ secrets.DOCKER_REPO }}/moring-api:${{ github.ref_name }} . -f moring-api/Dockerfile
docker push ${{ secrets.DOCKER_REPO }}/moring-api:${{ github.ref_name }}
deploy:
needs: build
runs-on: ubuntu-latest
environment: dev
steps:
- name : "NCP ๋ก๊ทธ์ธ ๋ฐ ๋ฐฐํฌ"
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.NCP_HOST }}
username: ${{ secrets.NCP_USERNAME }}
password: ${{ secrets.NCP_PASSWORD }}
port: ${{ secrets.NCP_PORT }}
script: |
sed -i 's|moring-api:[^ ]*|moring-api:${{ github.ref_name }}|' docker-compose.yml
sudo docker compose -f /root/docker-compose.yml pull
sudo docker compose -f /root/docker-compose.yml up api -d