Skip to content

Django CD DEV

Django CD DEV #80

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 }}
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