-
Notifications
You must be signed in to change notification settings - Fork 1
37 lines (32 loc) · 1.08 KB
/
docker-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
name: Docker Deploy
on:
repository_dispatch:
types: [deploy]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Upload to VPS
uses: appleboy/scp-action@master
with:
host: ${{ secrets.VPS_HOST }}
username: ${{ secrets.VPS_USER }}
key: ${{ secrets.VPS_SSH_KEY }}
port: ${{ secrets.VPS_PORT }}
source: ./deploy/production
target: ${{ secrets.VPS_WORK_DIR }}
- name: Execute deployment via SSH
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.VPS_HOST }}
username: ${{ secrets.VPS_USER }}
key: ${{ secrets.VPS_SSH_KEY }}
port: ${{ secrets.VPS_PORT }}
script: |
cd ${{ secrets.VPS_WORK_DIR }}/deploy/production
export $(grep -v '^#' ~/.env.local | xargs)
docker compose pull ${{ github.event.client_payload.app }}
docker compose up -d ${{ github.event.client_payload.app }}
docker image prune -f