Skip to content

ci: trigering deployment to ec2 #1

ci: trigering deployment to ec2

ci: trigering deployment to ec2 #1

Workflow file for this run

name: Deploy Django and Celery to EC2 instance
on:
push:
branches:
- dev
jobs:
deploy_project:
name: Deploy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4.1.7
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v44.5.7
with:
since_last_remote_commit: true
separator: ","
- name: Copy files via scp using SSH key
uses: appleboy/scp-action@v0.1.7
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.DEPLOY_KEY }}
port: ${{ secrets.PORT }}
source: "."
target: ${{ github.event.repository.name }}
build_project:
name: Build
needs: deploy_project
runs-on: ubuntu-latest
steps:
- name: Executing remote SSH commands using SSH key
uses: appleboy/ssh-action@v1.0.3
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.DEPLOY_KEY }}
port: ${{ secrets.PORT }}
script: |
cd aws-django-redis/
source venv/bin/activate
pip install -r requirements.txt
python manage.py migrate
sudo supervisorctl reread
sudo supervisorctl update
sudo supervisorctl restart all