Skip to content

docs: add README content #25

docs: add README content

docs: add README content #25

Workflow file for this run

name: Django CI/CD
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
build:
runs-on: ubuntu-22.04
strategy:
max-parallel: 4
matrix:
python-version: ['3.10']
steps:
- uses: actions/checkout@v4
- 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 -r requirements.txt
- name: Create env file
run: |
echo "SECRET_KEY=$SECRET_KEY" >> .env
echo "DB_NAME=$DB_NAME" >> .env
echo "DB_USER=$DB_USER" >> .env
echo "DB_PASSWORD=$DB_PASSWORD" >> .env
echo "DB_HOST=$DB_HOST" >> .env
echo "DB_PORT=$DB_PORT" >> .env
env:
SECRET_KEY: ${{ secrets.SECRET_KEY }}
DB_NAME: ${{ secrets.DB_NAME }}
DB_USER: ${{ secrets.DB_USER }}
DB_PASSWORD: ${{ secrets.DB_PASSWORD }}
DB_HOST: ${{ secrets.DB_HOST }}
DB_PORT: ${{ secrets.DB_PORT }}
- name: Run Tests
run: |
python manage.py test
deploy:
needs: build
runs-on: ubuntu-22.04
steps:
- name: Connect EC2 ssh
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USERNAME }}
key: ${{ secrets.SSH_PEM }}
script: |
sudo apt-get update
sudo apt-get -y upgrade
cd temp/UAM_KNU_backend
git switch main
git pull
pip install -r requirements.txt
python3 manage.py makemigrations
python3 manage.py migrate
sudo systemctl restart gunicorn
exit 0