Skip to content

Django CD DEV

Django CD DEV #299

Workflow file for this run

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