refactor:change category from list to boolean #48
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 ] | ||
pull_request: | ||
branches: [ main ] | ||
jobs: | ||
ci: | ||
name: 'Django CI' | ||
runs-on: ubuntu-20.04 | ||
strategy: | ||
max-parallel: 4 | ||
matrix: | ||
python-version: [3.9] | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Install Dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -r requirements.txt | ||
- name: create-json | ||
id: create-json | ||
uses: jsdaniell/[email protected] | ||
with: | ||
name: "secrets.json" | ||
json: ${{ secrets.SECERT_JSON }} | ||
- name: Run Tests | ||
run: | | ||
python manage.py test | ||
cd: | ||
name: 'Django CD' | ||
needs: ci | ||
runs-on: Amazon Linux 2023.4.20240513 | ||
steps: | ||
- name: EC2 ssh connection test | ||
uses: appleboy/ssh-action@master | ||
with: | ||
host: ${{ secrets.SSH_HOST }} # 연결할 EC2 | ||
username: ${{ secrets.SSH_USERNAME }} # 사용자 | ||
key: ${{ secrets.SSH_PEM }} # pem 파일 내용 | ||
command_timeout: 3m # timeout 시간 설정 | ||
script: | | ||
sudo apt-get update | ||
sudo apt-get -y upgrade | ||
cd {~/Back-end/} | ||
source {venv}/bin/activate | ||
git pull | ||
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 {pure_plate}.wsgi > nohup.out 2> nohup.err < /dev/null & | ||
exit 0 |