Django CD DEV #200
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} | |
jobs: | |
deploy: | |
runs-on: self-hosted | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- 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: Docker compose COLLECTSTATIC | |
run: docker compose -f docker-compose.dev.yml exec ${{ vars.API_DEV }} python manage.py collectstatic --no-input | |
- 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 |