-
Notifications
You must be signed in to change notification settings - Fork 0
53 lines (44 loc) · 1.47 KB
/
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
name: deploy
on:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
environment: dev
name: build image
steps:
- name: get repo from github
uses: actions/checkout@v3
- name: setup jdk17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- name: Gradle Ready
run: chmod +x gradlew
- name: Gradle Build
run: ./gradlew clean build -x test
- name: Docker Login
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and Push Docker Image
run: |
docker build -t ${{ secrets.DOCKER_USERNAME }}/booklog:latest .
docker push ${{ secrets.DOCKER_USERNAME }}/booklog:latest
deploy:
needs: build
runs-on: ubuntu-latest
environment: dev
steps:
- name: Deploy to Team Server
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.TEAM_SERVER_HOST }}
username: ${{ secrets.TEAM_SERVER_USERNAME }}
password: ${{ secrets.TEAM_SERVER_PASSWORD }}
port: ${{ secrets.TEAM_SERVER_PORT }}
script: |
echo "${{ secrets.TEAM_SERVER_PASSWORD }}" | sudo -S docker-compose -f /home/haneum/docker-compose.yml pull
echo "${{ secrets.TEAM_SERVER_PASSWORD }}" | sudo -S docker-compose -f /home/haneum/docker-compose.yml up -d