Merge pull request #126 from cau-likelion-org/refactoring #200
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 EC2 Deploy | |
on: | |
push: | |
branches: [main] | |
jobs: | |
deploy: | |
name: "Django CD" | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: EC2 ssh connection test | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ secrets.SSH_HOST }} | |
username: ${{ secrets.SSH_USERNAME }} | |
key: ${{ secrets.SSH_PEM }} | |
command_timeout: 3m | |
script: | | |
sudo apt-get update | |
sudo apt-get -y upgrade | |
cd cau-likelion-django | |
source venv/bin/activate | |
git pull origin main | |
sudo lsof -t -i tcp:8000 | xargs kill -9 | |
pip install -r requirements.txt | |
python manage.py makemigrations | |
python manage.py migrate | |
nohup gunicorn --bind 0.0.0.0:8000 config.wsgi > nohup.out 2> nohup.err < /dev/null & | |
exit 0 |