Delete backend/migrations/__pycache__ directory #7
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 Deployment Workflow | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
deploy: | |
runs-on: self-hosted | |
steps: | |
- name: Change file owner | |
run: | | |
sudo chown -R $(id -u):$(id -g) ../../ | |
- name: Check if folder exists | |
run: | | |
echo "Create if dosen't exist /var/www/${{ github.event.repository.name }}" | |
sudo mkdir -p /var/www/${{ github.event.repository.name }}/static | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
with: | |
path: 'prod/' | |
- name: Set up Python 3.9 | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.9 | |
- name: Build Docker Images | |
run: | | |
cd prod | |
cp ../../.env . | |
docker-compose -f docker-compose.prod.yml build | |
docker-compose -f docker-compose.prod.yml run backend python manage.py check --deploy | |
docker-compose -f docker-compose.prod.yml run backend python manage.py migrate | |
docker-compose -f docker-compose.prod.yml run backend python manage.py createsuperuser --noinput 2> /dev/null || true | |
docker-compose -f docker-compose.prod.yml run backend python manage.py collectstatic --no-input | |
- name: Run tests | |
run: | | |
cd prod | |
# docker-compose -f docker-compose.prod.yml run backend python manage.py test | |
- name: Run Deployment commands | |
run: | | |
cd prod | |
docker-compose -f docker-compose.prod.yml up --build -d |