-
Notifications
You must be signed in to change notification settings - Fork 4
37 lines (35 loc) · 1.19 KB
/
restart-services.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
name: Restart Services
on:
workflow_call:
inputs:
ENVIRONMENT:
type: string
required: true
outputs:
CHANGES:
description: "Whether `configs/` or the `docker-compose` files have changed since the last successfull workflow run."
value: ${{ jobs.check_config_changes.outputs.CHANGES }}
jobs:
check_config_changes:
uses: ./.github/workflows/diff-last-run.yml
with:
CHECK_DIFF_LOCATIONS: docker-compose* configs/ .env.example
restart_services:
needs: check_config_changes
if: ${{ needs.check_config_changes.outputs.changes == 'true' }}
runs-on: ubuntu-latest
environment:
name: ${{ inputs.ENVIRONMENT }}
steps:
- name: Restart containers
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USERNAME }}
password: ${{ secrets.SSH_PASSWORD }}
script: |
cd /srv
echo "Restarting containers: tiles, db, traefik and proxy"
docker compose pull
docker compose -f docker-compose.yml -f docker-compose.network.yml up tiles db traefik proxy -d
docker image prune -fa