-
Notifications
You must be signed in to change notification settings - Fork 2
32 lines (27 loc) · 954 Bytes
/
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
name: CI | Deploy to DO Droplet
on:
push:
branches: [ main ]
workflow_dispatch:
jobs:
deploy:
runs-on: ubuntu-18.04
steps:
- name: login, shutdown container, pull latest master and trigger fresh build
uses: appleboy/ssh-action@master
with:
host: ${{secrets.DO_HOST}}
username: ${{secrets.DO_USERNAME}}
password: ${{secrets.DO_PASSWORD}}
script: |
cd createYourBread-N-Breakfast
#set all the env variables here
set -o allexport; source ~/.env; set +o allexport
#shut down all the containers:
docker-compose down
# remove all the dangling containers
docker rmi $(docker images -f dangling=true -q)
git checkout main
git pull
#rebuild from the existing app as and when required
docker-compose up --build -d