generated from ita-social-projects/DevTemplate
-
Notifications
You must be signed in to change notification settings - Fork 3
56 lines (51 loc) · 2.33 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
44
45
46
47
48
49
50
51
52
53
54
55
56
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: ${{ vars.EMAIL_BACKEND }}
EMAIL_HOST: ${{ vars.EMAIL_HOST }}
EMAIL_PORT: ${{ vars.EMAIL_PORT }}
EMAIL_USE_TLS: ${{ vars.EMAIL_USE_TLS }}
EMAIL_HOST_USER: ${{ vars.EMAIL_HOST_USER }}
EMAIL_HOST_PASSWORD: ${{ vars.EMAIL_HOST_PASSWORD }}
CORS_ORIGIN_WHITELIST: ${{ vars.CORS_ORIGIN_WHITELIST }}
REACT_APP_BASE_API_URL: ${{ vars.REACT_APP_BASE_API_URL }}
REACT_APP_PUBLIC_URL: ${{ vars.REACT_APP_PUBLIC_URL }}
ALLOWED_ENV_HOST: ${{ vars.ALLOWED_ENV_HOST }}
REDIS_URL: ${{ vars.REDIS_URL }}
jobs:
deploy:
runs-on: self-hosted
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Docker compouse DOWN old Django container and frontend container (+internal nginx)
run: docker compose -f docker-compose.dev.yml down -v
- name: Docker compouse UP Django container and frontend container (+internal nginx)
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 compose LOADDATA activities
run: docker compose -f docker-compose.dev.yml exec ${{ vars.API_DEV }} python manage.py loaddata activities
- name: Docker compose LOADDATA categories
run: docker compose -f docker-compose.dev.yml exec ${{ vars.API_DEV }} python manage.py loaddata categories
- name: Docker compose LOADDATA regions
run: docker compose -f docker-compose.dev.yml exec ${{ vars.API_DEV }} python manage.py loaddata regions
- name: nginx
run: docker compose -f docker-compose.nginx.yml down -v
- name: nginx
run: docker compose -f docker-compose.nginx.yml up -d --build
- name: Clean up old docker resources
run: |
docker system df
docker container prune -f
docker image prune -f
docker buildx prune -f