-
Notifications
You must be signed in to change notification settings - Fork 0
35 lines (33 loc) · 998 Bytes
/
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
name: Deploy to EC2
on:
pull_request:
types: [closed]
workflow_dispatch:
inputs:
deploy:
description: 'Deploy to EC2?'
required: true
default: 'false'
type: choice
options:
- 'true'
- 'false'
jobs:
deploy:
runs-on: ubuntu-latest
if: |
(github.event_name == 'workflow_dispatch' && github.event.inputs.deploy == 'true') ||
(github.event_name == 'pull_request' && github.event.pull_request.merged == true && contains(github.event.pull_request.labels.*.name, 'deploy'))
steps:
- name: Deploy to EC2
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.EC2_HOST }}
username: ${{ secrets.EC2_USER }}
key: ${{ secrets.EC2_SSH_KEY }}
script: |
cd ~/geoChat/
docker compose down
docker system prune -a -f --filter "until=24h"
git pull origin main
docker compose up -d --build