-
Notifications
You must be signed in to change notification settings - Fork 0
48 lines (41 loc) · 1.33 KB
/
stag-client-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
name: stag-client-api-deploy
on:
push:
branches: [ "stag/client" ]
workflow_dispatch:
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: 'corretto'
java-version: '17'
- name: app clean
run: ./gradlew clean
- name: client api build
run: ./gradlew :likelion-client:build -x test
- name: Docker login
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_EMAIL }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Build and push
uses: docker/build-push-action@v3
with:
context: ./likelion-client
push: true
tags: ${{ secrets.DOCKER_CLIENT_API_STAG_IMAGE }}
build-args: PROFILE=stag
- name: client-api-deploy
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.SSH_USERNAME }}
key: ${{ secrets.KEY }}
script: |
sudo docker rm -f ${{ secrets.DOCKER_CLIENT_API_STAG_CONTAINER }}
sudo docker rmi ${{ secrets.DOCKER_CLIENT_API_STAG_IMAGE }}
sudo docker-compose -f ${{ secrets.DOCKER_COMPOSE_DIRECTORY }} up -d
sudo docker image prune -f