Update settings.py #4
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: ambassadors_crm workflow | |
on: [push] | |
jobs: | |
tests: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ["3.9"] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v3 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install flake8 pep8-naming flake8-broken-line flake8-return isort | |
pip install -r requirements.txt | |
- name: Test with flake8 and django tests | |
run: | | |
python -m flake8 | |
build_and_push_to_docker_hub: | |
runs-on: ubuntu-latest | |
needs: tests | |
steps: | |
- name: Check out the repo | |
uses: actions/checkout@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Login to Docker | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Push to Docker Hub backend | |
uses: docker/build-push-action@v2 | |
with: | |
context: ./ | |
file: ./Dockerfile | |
push: true | |
tags: ${{ secrets.DOCKER_USERNAME }}/ambassadors_crm:latest | |
deploy: | |
runs-on: ubuntu-latest | |
needs: build_and_push_to_docker_hub | |
steps: | |
- name: executing remote ssh commands to deploy | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ secrets.HOST_IP }} | |
username: ${{ secrets.HOST_USERNAME }} | |
password: ${{ secrets.HOST_PASSWORD }} | |
script: | | |
sudo docker-compose stop | |
sudo docker-compose rm -f backend | |
sudo docker image rm -f ${{ secrets.DOCKER_USERNAME }}/ambassadors_crm:latest | |
sudo docker-compose pull | |
sudo docker-compose up -d |