generated from ita-social-projects/DevTemplate
-
Notifications
You must be signed in to change notification settings - Fork 3
31 lines (28 loc) · 1.01 KB
/
django_cd_prod.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
name: Django CD PROD
on: workflow_dispatch
env:
DEBUG: ${{ vars.PROD_DEBUG }}
SECRET_KEY: ${{ secrets.PROD_SECRET_KEY }}
ENGINE: ${{ vars.ENGINE }}
HOST: ${{ vars.POSTGRES_HOST }}
PORT: ${{ vars.POSTGRES_PORT }}
DB: ${{ vars.PROD_DB }}
USER: ${{ vars.POSTGRES_USER }}
PASSWORD: ${{ secrets.POSTGRES_PASSWORD }}
DATABASE: ${{ vars.POSTGRES_DB }}
jobs:
deploy:
runs-on: self-hosted
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Docker compouse DOWN old containers
run: docker compose -f docker-compose.prod.yml down -v
- name: Docker compouse UP new containers
run: docker compose -f docker-compose.prod.yml up -d --build
- name: Docker compouse MIGRATE models
run: docker compose -f docker-compose.prod.yml exec web-prod python manage.py migrate --noinput
- name: Clean up old docker resources
run: |
docker container prune -f
docker image prune -f