-
-
Notifications
You must be signed in to change notification settings - Fork 1
37 lines (33 loc) · 1.07 KB
/
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: Deploy
on:
workflow_run:
workflows: ["Test"]
branches: [main]
types:
- completed
workflow_dispatch:
jobs:
deploy_to_production:
name: Connect and deploy
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: Connect And Pull
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USER }}
key: ${{ secrets.KEY }}
script: |
cd /home/ubuntu/django-ogcapif
docker-compose down -v --remove-orphans
git checkout main && git pull -f
docker-compose up -d --build --force-recreate
docker-compose exec django python manage.py migrate --no-input
docker-compose exec django python manage.py collectstatic --no-input
docker-compose exec django python manage.py populate_users
docker-compose exec django python manage.py populate_data
- name: Failure logs
if: failure()
run: docker-compose logs django