Skip to content

chore: update JS_VERSION to update caches #3

chore: update JS_VERSION to update caches

chore: update JS_VERSION to update caches #3

name: Production deploy
on:
push:
tags:
- v**
jobs:
deploy:
name: Deploy to production server
runs-on: [self-hosted, sport]
environment:
name: production
url: https://sport.innopolis.university
steps:
- name: Deploy via SSH
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
password: ${{ secrets.PASSWORD }}
port: ${{ secrets.PORT }}
script: |
cd ${{ secrets.REPOSITORY_PATH }}/compose
git reset --hard
git checkout ${GITHUB_REF}
git pull
python3 ${{ secrets.BACKUP_SCRIPT }}
docker-compose -f docker-compose-prod.yml build
docker-compose -f docker-compose-prod.yml down
docker-compose -f docker-compose-prod.yml up -d
docker-compose -f docker-compose-prod.yml exec -T adminpanel bash -c "while !</dev/tcp/db/5432; do sleep 1; done;"
docker-compose -f docker-compose-prod.yml exec -T adminpanel bash -c './manage.py collectstatic --noinput && ./manage.py migrate && ./manage.py createcachetable'
docker-compose -f docker-compose-prod.yml build nginx
docker-compose -f docker-compose-prod.yml restart nginx
python3 ${{ secrets.BACKUP_SCRIPT }}