-
Notifications
You must be signed in to change notification settings - Fork 0
53 lines (41 loc) · 1.46 KB
/
deploy-to-vps.yml
File metadata and controls
53 lines (41 loc) · 1.46 KB
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: build-and-deploy-tarball
on:
push:
branches: ["master", "ci/cd-implementation"]
jobs:
build-and-deploy-tarball:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4
- name: setup for docker building tools
uses: docker/setup-buildx-action@v3
- name: install utilities
run: |
sudo apt-get install docker-compose
- name: create .env for remote
run: |
cat > .env <<EOF
BACKEND_PORT=${{ secrets.BACKEND_PORT }}
WEBVIEW_PORT=${{ secrets.WEBVIEW_PORT }}
VITE_BACKEND_URL=${{ secrets.VITE_BACKEND_URL }}
BACKEND_HOST=${{ secrets.BACKEND_HOST }}
WEBVIEW_URL=${{ secrets.WEBVIEW_URL }}
EOF
- name: build images
run: |
docker-compose -f building.yml build
- name: save image
run: |
mkdir images
docker save milk-folio_backend:latest milk-folio_webview:latest > ./images/images.tar
# this for the deployment of the images
- name: Install SSH Key
uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.VPS_SSH_KEY }}
known_hosts: 'PlaceHolder'
- name: Adding Known Hosts
run: ssh-keyscan -H ${{ secrets.VPS_HOST }} >> ~/.ssh/known_hosts
- name: Deploy with rsync
run: rsync -avhPW --progress ./images/ ${{ secrets.VPS_USER }}@${{ secrets.VPS_HOST }}:/home/ec2-user/