generated from ita-social-projects/DevTemplate
-
Notifications
You must be signed in to change notification settings - Fork 3
43 lines (38 loc) · 1.46 KB
/
django_cd_dev.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
38
39
40
41
42
43
name: Django CD DEV
on: workflow_dispatch
env:
DEBUG: ${{ vars.DEV_DEBUG }}
SECRET_KEY: ${{ secrets.DEV_SECRET_KEY }}
ENGINE: ${{ vars.ENGINE }}
DB_HOST: ${{ vars.POSTGRES_HOST }}
DB_PORT: ${{ vars.POSTGRES_PORT }}
PG_DB: ${{ vars.DEV_DB }}
PG_USER: ${{ vars.POSTGRES_USER }}
PG_PASSWORD: ${{ secrets.POSTGRES_PASSWORD }}
POSTGRES_DB: ${{ vars.POSTGRES_DB }}
EMAIL_BACKEND: "django.core.mail.backends.smtp.EmailBackend"
EMAIL_HOST: ""
EMAIL_PORT: ""
EMAIL_USE_TLS: ""
EMAIL_HOST_USER: ""
EMAIL_HOST_PASSWORD: ""
CORS_ORIGIN_WHITELIST: ${{ vars.CORS_ORIGIN_WHITELIST }}
REACT_APP_BASE_API_URL: ${{ vars.API_DEV }}
jobs:
deploy:
runs-on: self-hosted
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Docker compouse DOWN old Django container
run: docker compose -f docker-compose.dev.yml down -v
- name: Docker compouse UP Django container
run: docker compose -f docker-compose.dev.yml up -d --build
- name: Docker compouse MIGRATE models
run: docker compose -f docker-compose.dev.yml exec ${{ vars.API_DEV }} python manage.py migrate --noinput
- name: Docker compouse COLLECTSTATIC
run: docker compose -f docker-compose.dev.yml exec ${{ vars.API_DEV }} python manage.py collectstatic --no-input
- name: Clean up old docker resources
run: |
docker container prune -f
docker image prune -f