-
Notifications
You must be signed in to change notification settings - Fork 1
52 lines (40 loc) · 1.87 KB
/
main.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
# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
name: petplanet-backend springcloud CI with Maven
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build Docker Images
run: |
docker-compose -f docker-compose.yml build
- name: Install SSH Pass
run: |
sudo apt-get update
sudo apt-get install -y sshpass
- name: Connect Docker on Ubuntu Server!
env:
SSH_PASSWORD: ${{ secrets.SSH_PASSWORD }}
SERVER_IP: ${{ secrets.SSH_HOST }}
SSH_USER: ${{ secrets.SSH_USER }}
run: |
sshpass -p "${SSH_PASSWORD}" ssh -o StrictHostKeyChecking=no ${SSH_USER}@${SERVER_IP} "docker version"
- name: Push images to Docker Repository!
env:
SSH_PASSWORD: ${{ secrets.SSH_PASSWORD }}
SERVER_IP: ${{ secrets.SSH_HOST }}
SSH_USER: ${{ secrets.SSH_USER }}
run: |
docker save petplanet-pet-image:latest | gzip | sshpass -p "${SSH_PASSWORD}" ssh -o StrictHostKeyChecking=no ${SSH_USER}@${SERVER_IP} "gzip -d | docker load"
docker save petplanet-post-image:latest | gzip | sshpass -p "${SSH_PASSWORD}" ssh -o StrictHostKeyChecking=no ${SSH_USER}@${SERVER_IP} "gzip -d | docker load"
docker save petplanet-user-image:latest | gzip | sshpass -p "${SSH_PASSWORD}" ssh -o StrictHostKeyChecking=no ${SSH_USER}@${SERVER_IP} "gzip -d | docker load"