Skip to content

Update backend-ec2-deploy.yml #7

Update backend-ec2-deploy.yml

Update backend-ec2-deploy.yml #7

name: Deploy backend to EC2
on:
push:
branches: Level--300
jobs:
Deploy:
name: Deploy to EC2
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Install SSH Key
uses: webfactory/ssh-agent@v0.5
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
- name: SSH into EC2 Instance
run: |
ssh -o StrictHostKeyChecking=no -i ${{ secrets.SSH_PRIVATE_KEY }} ubuntu@ec2-13-53-198-163.eu-north-1.compute.amazonaws.com << EOF
# Commands to pull the latest code and restart your backend service
cd server
git pull origin main
systemctl restart your-backend-service
EOF