Deploy #63
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: 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 |