-
Notifications
You must be signed in to change notification settings - Fork 0
58 lines (50 loc) · 1.59 KB
/
deploy.yaml
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
name: Deploy
on:
push:
# branches:
# - master
jobs:
build-and-push:
runs-on: ubuntu-20.04
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install Compose
uses: ndeloof/[email protected]
with:
version: v2.20.2
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build docker images
run: docker compose build --push
deploy:
needs: build-and-push
runs-on: ubuntu-20.04
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Copy files to VM
uses: appleboy/scp-action@master
with:
host: ${{ vars.VM_HOST }}
username: ${{ vars.VM_USERNAME }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
overwrite: true
source: "docker-compose.yml,deployment"
target: /home/${{ vars.VM_USERNAME }}/AAISS-2023
- name: Deploy to the VM
uses: appleboy/ssh-action@master
env:
SECRET_KEY: ${{ secrets.SECRET_KEY }}
EMAIL_HOST_PASSWORD: ${{ secrets.EMAIL_HOST_PASSWORD }}
ZIFY_AUTH: ${{ secrets.ZIFY_AUTH }}
with:
host: ${{ vars.VM_HOST }}
username: ${{ vars.VM_USERNAME }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
envs: SECRET_KEY,EMAIL_HOST_PASSWORD,ZIFY_AUTH
script: |
docker compose -f AAISS-2023/docker-compose.yml up -d --pull always --force-recreate --no-build