Skip to content

Deploy

Deploy #58

Workflow file for this run

name: Deploy
on:
workflow_run:
workflows: ["Test"]
branches: [main]
types:
- completed
workflow_dispatch:
jobs:
deploy_to_production:
name: Connect and deploy
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: Connect And Pull
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USER }}
key: ${{ secrets.KEY }}
script: |
cd /home/ubuntu/django-ogcapif
docker-compose down -v --remove-orphans
git checkout main && git pull -f
docker-compose up -d --build --force-recreate
docker-compose exec django python manage.py migrate --no-input
docker-compose exec django python manage.py collectstatic --no-input
docker-compose exec django python manage.py populate_users
docker-compose exec django python manage.py populate_data
- name: Failure logs
if: failure()
run: docker-compose logs django