Skip to content

Update deploy_test.yml #103

Update deploy_test.yml

Update deploy_test.yml #103

Workflow file for this run

name: Production Deployment Workflow
on:
push:
branches:
- gargi-production # Trigger only for production branch
jobs:
deploy:
runs-on: self-hosted
env:
REPO_NAME: ${{ github.event.repository.name }}
COMPOSE_FILE: docker-compose.yml
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Dotenv Action
uses: falti/dotenv-action@v1.1.4
with:
export-variables: true
keys-case: bypass
# Remove previous production containers at the beginning
- name: Remove previous production containers (if any)
run: docker rm -f secfit_stag_backend || true # Remove any previous containers
- name: Tear down previous production containers (if any)
run: docker compose -f $COMPOSE_FILE down || true
- name: Set up test containers
run: docker compose -f docker-compose.stag.yml up --build -d
- name: Run backend unit tests
run: docker exec secfit_stag_backend python manage.py test tests
- name: Tear down test containers
run: docker compose -f docker-compose.stag.yml down
- name: Build and run docker image
run: docker compose -f $COMPOSE_FILE up --_