-
Notifications
You must be signed in to change notification settings - Fork 0
76 lines (66 loc) · 2.56 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
name: Deploy
on:
push:
branches: [ main ]
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Frontend
id: frontend
env:
REGISTRY_NAME: pinkynrg
REPOSITORY_NAME: hoomes_frontend
IMAGE_TAG: ${{ github.sha }}
run: |
docker build -f Dockerfile.frontend -t $REGISTRY_NAME/$REPOSITORY_NAME:$IMAGE_TAG -t $REGISTRY_NAME/$REPOSITORY_NAME:latest .
echo "Pushing image to Registry..."
docker login -u pinkynrg -p ${{ secrets.DOCKER_HUB_LOGIN_TOKEN }}
docker push $REGISTRY_NAME/$REPOSITORY_NAME:$IMAGE_TAG
docker push $REGISTRY_NAME/$REPOSITORY_NAME:latest
echo "::set-output name=image::$REGISTRY_NAME/$REPOSITORY_NAME:$IMAGE_TAG"
- name: Backend
id: backend
env:
REGISTRY_NAME: pinkynrg
REPOSITORY_NAME: hoomes_backend
IMAGE_TAG: ${{ github.sha }}
run: |
docker build -f Dockerfile.backend -t $REGISTRY_NAME/$REPOSITORY_NAME:$IMAGE_TAG -t $REGISTRY_NAME/$REPOSITORY_NAME:latest .
echo "Pushing image to Registry..."
docker login -u pinkynrg -p ${{ secrets.DOCKER_HUB_LOGIN_TOKEN }}
docker push $REGISTRY_NAME/$REPOSITORY_NAME:$IMAGE_TAG
docker push $REGISTRY_NAME/$REPOSITORY_NAME:latest
echo "::set-output name=image::$REGISTRY_NAME/$REPOSITORY_NAME:$IMAGE_TAG"
deploy:
name: Deploy
runs-on: ubuntu-latest
needs: build
steps:
- name: checking out project
uses: actions/checkout@v2
- name: copy file via ssh password
uses: appleboy/[email protected]
with:
host: ${{ secrets.HOOMES_SSH_HOST }}
username: ${{ secrets.HOOMES_SSH_USER }}
password: ${{ secrets.HOOMES_SSH_PASSWORD }}
port: ${{ secrets.HOOMES_SSH_PORT }}
source: "docker-compose.yml,shell.db"
target: "~/hoomes"
- name: executing docker compose stuff on remove host
uses: appleboy/[email protected]
with:
host: ${{ secrets.HOOMES_SSH_HOST }}
username: ${{ secrets.HOOMES_SSH_USER }}
password: ${{ secrets.HOOMES_SSH_PASSWORD }}
port: ${{ secrets.HOOMES_SSH_PORT }}
script: |
cd hoomes
[ -e "data.db" ] && rm "shell.db" || mv "shell.db" "data.db"
docker compose down
docker compose pull
NORD_VPN_PRIVATE_KEY=${{ secrets.NORD_VPN_PRIVATE_KEY }} docker compose up -d