Update backend-ec2-deploy.yml #7
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: 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 | |