Update main.yml #13
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 CI | |
on: | |
push: | |
branches: [ "master" ] | |
pull_request: | |
branches: [ "master" ] | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v3 | |
with: | |
python-version: 3.9 | |
- name: Install Dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
- name: Run Tests | |
run: | | |
python manage.py test | |
build: | |
runs-on: ubuntu-latest | |
needs: test | |
steps: | |
- name: Django-app | |
run: | | |
echo build: | |
deploy: | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: deploy Via SSH | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ secrets.SSH_HOST }} | |
username: ${{ secrets.SSH_USERNAME }} | |
key: ${{ secrets.SSH_PRIVATE_KEY }} | |
script: | | |
cd /home/ubuntu/Django-Poll-App | |
git pull origin main | |
gunicorn --bind 0.0.0.0:8000 pollme.wsgi:application | |
sudo touch /etc/systemd/system/gunicorn.service | |
sudo systemctl daemon-reload | |
sudo systemctl start /etc/systemd/system/gunicorn.service | |
sudo systemctl enable gunicorn.service | |