Skip to content

Update settings.py

Update settings.py #74

Workflow file for this run

name: Django CI/CD Pipeline
'on':
# push code and github action trigger with manually
# workflow_dispatch:
# push or pull request github action trigger automatically
push:
branches: [main] # Adjust the branch name as needed
# pull_request:
# branches: [main] # Adjust the branch name as needed
jobs:
build_and_test:
name: Build and Test
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r blog/requirements.txt
- name: Run tests
run: python blog/manage.py test
deploy:
name: Deploy to EC2 on main branch push
# needs: build_and_test
env:
PRIVATE_KEY: ${{ secrets.EC2_SSH_KEY }}
HOSTNAME: ${{secrets.HOST_DNS}}
USER_NAME: ${{secrets.USERNAME}}
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Deploy to Server 1
run: |
echo "$PRIVATE_KEY" > private_key && chmod 600 private_key
ssh -o StrictHostKeyChecking=no -i private_key ${USER_NAME}@${HOSTNAME} 'bash -s'< .github/workflows/deploy_script.sh