-
Notifications
You must be signed in to change notification settings - Fork 1
54 lines (51 loc) · 1.69 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
53
54
name: deploy
on:
push:
branches:
- master
paths-ignore:
- '**/terraform/**'
- '**/README.md'
- '**/.gitignore'
jobs:
copy_files:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: rsync deployments
uses: burnett01/[email protected]
with:
switches: -avzr --quiet --include="docker-compose.yaml" --exclude="*"
remote_path: /srv/infrastructure
remote_host: ${{ secrets.DEPLOY_HOST }}
remote_port: ${{ secrets.DEPLOY_PORT }}
remote_user: ${{ secrets.DEPLOY_USER }}
remote_key: ${{ secrets.DEPLOY_KEY }}
start_docker:
needs: copy_files
runs-on: ubuntu-20.04
steps:
- name: create secrets
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.DEPLOY_HOST }}
username: ${{ secrets.DEPLOY_USER }}
key: ${{ secrets.DEPLOY_KEY }}
port: ${{ secrets.DEPLOY_PORT }}
script: cd /srv/infrastructure; echo "${{ secrets.DOCKER_COMPOSE_ENV }}" > .env
- name: update images
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.DEPLOY_HOST }}
username: ${{ secrets.DEPLOY_USER }}
key: ${{ secrets.DEPLOY_KEY }}
port: ${{ secrets.DEPLOY_PORT }}
script: cd /srv/infrastructure; docker-compose pull
- name: start services
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.DEPLOY_HOST }}
username: ${{ secrets.DEPLOY_USER }}
key: ${{ secrets.DEPLOY_KEY }}
port: ${{ secrets.DEPLOY_PORT }}
script: cd /srv/infrastructure; docker-compose up -d --remove-orphans